JAVA Strings What will be the output of the following program?public class Test{ public static void main(String args[]){String s1 = "java";String s2 = "java";System.out.println(s1.equals(s2));System.out.println(s1 == s2); }} true false true true false false false true true false true true false false false true ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings The class string belongs to ................. package. java.applet java.string java.awt java.lang java.applet java.string java.awt java.lang ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings How many objects will be created?String a = new String("Examveda");String b = new String("Examveda");String c = "Examveda";String d = "Examveda"; 3 2 4 None of this 3 2 4 None of this ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings String str1 = "Kolkata".replace('k', 'a');In the above statement, the effect on string Kolkata is All characters k are replaced by a. Displays error message The first occurrence of k is replaced by a. All characters a are replaced by k. All characters k are replaced by a. Displays error message The first occurrence of k is replaced by a. All characters a are replaced by k. ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings Determine output:public class Test{ public static void main(String args[]){ String str = null; if(str.length() == 0){ System.out.print("1"); } else if(str == null){ System.out.print("2"); } else{ System.out.print("3"); } }} An exception is thrown at runtime. "3" is printed. "2" is printed. Compilation fails. "1" is printed. An exception is thrown at runtime. "3" is printed. "2" is printed. Compilation fails. "1" is printed. ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings The String method compareTo() returns true an int value 1 -1 false true an int value 1 -1 false ANSWER DOWNLOAD EXAMIANS APP