Java OCA OCP Practice Question 1485

Question

Which of the following expressions will evaluate to true if preceded by the following code?

String a = "java"; 
char[] b =  {'j', 'a','v',  'a'  }; 
String c = new String (b); 
String d = a; 

Select 3 options

  • A. (a == d)
  • B. (b == d)
  • C. (a == "java")
  • D. a.equals (c)


Correct Options are  : A C D

Note

For Option B.

b and d can not even be compared because they are of different types.

For Option D.

Note that a == c will be false because doing 'new' creates an entirely new object.




PreviousNext

Related