Question 26
|
Which of the following lines will print false? 1. public class MyClass 2. { 3. static String s1 = "I am unique!"; 4. public static void main(String args[]) 5. { 6. String s2 = "I am unique!"; 7. String s3 = new String(s1); 8. System.out.println(s1 == s2); 9. System.out.println(s1.equals(s2)); 10. System.out.println(s3 == s1); 11. System.out.println(s3.equals(s1)); 12. System.out.println(TestClass.s4 == s1); 13. } 14. } 15. 16. class TestClass 17. { 18. static String s4 = "I am unique!"; 19. }
|
||
| Lines 10 and 12 | ||
| Line 12 only | ||
| Lines 8 and 10 | ||
| None of these | ||
Back to beginning | Next Question |
||
