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"); } }} Compilation fails. An exception is thrown at runtime. "3" is printed. "1" is printed. "2" is printed. Compilation fails. An exception is thrown at runtime. "3" is printed. "1" is printed. "2" is printed. ANSWER DOWNLOAD EXAMIANS APP
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 true false true true false false false true true false true true false false false ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What will be the output of the following program?public class Test{ public static void main(String args[]){String str1 = "one";String str2 = "two";System.out.println(str1.concat(str2)); }} None of these one two twoone onetwo None of these one two twoone onetwo ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What will be the output?String str1 = "abcde";System.out.println(str1.substring(1, 3)); bcd bc abcd None of these abc bcd bc abcd None of these abc ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings The String method compareTo() returns -1 true an int value false 1 -1 true an int value false 1 ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings String str1 = "Kolkata".replace('k', 'a');In the above statement, the effect on string Kolkata is All characters a are replaced by k. The first occurrence of k is replaced by a. All characters k are replaced by a. Displays error message All characters a are replaced by k. The first occurrence of k is replaced by a. All characters k are replaced by a. Displays error message ANSWER DOWNLOAD EXAMIANS APP