What is the output of the following code:

```
public class Test {
public static void main(String[] args) {
String s1 = new String("Java");
String s2 = new String("Java");
System.out.print((s1 == s2) + " " + (s1.equals(s2)));
}
}
```
a. false false
b. true true
c. false true
d. true false


c. false true
s1 == s2 is false, since s1 and s2 are two different objects. s1.equals(s2) is true since the equals method returns true if two strings have the same content.


Computer Science & Information Technology

You might also like to view...

Describe an advantage of using scwcmd.

What will be an ideal response?

Computer Science & Information Technology

Windows 8.1 uses ________ as its primary name resolution service

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which of the following does NOT happen when you add a 25th item to the Office Clipboard?

A. The last item you collected is deleted. B. The first item you collected is deleted. C. The existing items on the Clipboard are moved down the task pane. D. The new item is displayed at the top of the Clipboard task pane.

Computer Science & Information Technology

Formatting a cell in Number format you can't set Select one:

A. Decimal Places B. Negative numbers C. Use 1000 separator D. Currency Symbol

Computer Science & Information Technology