What is the output of the following code?

```
ArrayList list = new ArrayList();
String s1 = new String("Java");
String s2 = new String("Java");
list.add(s1);
list.add(s2);
System.out.println((list.get(0) == list.get(1)) + " " + (list.get(0)).equals(list.get(1)));
```
a. true false
b. false true
c. true true
d. false false


b list.get(0) and list.get(1) point to two different objects with the same string contents.

Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1. The FlowLayout manager does not allow the programmer to align components. 2. You must use the statement import java.swing.*; in order to use the ItemListener interface. 3. When a splash screen is displayed, the application does not load and execute until the user clicks the splash screen image with the mouse. 4. The ability to display splash screens was introduced in Java 6.

Computer Science & Information Technology

In SQL the bit type is equivalent to which Visual Basic data type?

a. Short b. Boolean c. Integer d. String

Computer Science & Information Technology

What is the generic file format for spreadsheet files?

A) .rtf B) .xls C) .csv D) .pdf

Computer Science & Information Technology

What does it mean to say that there is a relationship between two tables?

What will be an ideal response?

Computer Science & Information Technology