Given the code fragment:
Which code fragment, when inserted at line n1, enables the App class to print Equal?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Given the code fragment:
Which code fragment, when inserted at line n1, enables the App class to print Equal?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Answer: B
package q069;
public class App {
public static void main(String[] args) {
String str1 = “Java”;
String str2 = new String(“Java”);
//line n1
if (str1.equalsIgnoreCase(str2)){
System.out.println(“Equal”);
} else {
System.out.println(“Not Equal”);
}
}
}
/* Output:
Equal
*/
thank you
B