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. Displays error message All characters k are replaced by a. The first occurrence of k is replaced by a. All characters a are replaced by k. Displays error message All characters k are replaced by a. The first occurrence of k is replaced by a. ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings The String method compareTo() returns false 1 -1 an int value true false 1 -1 an int value true ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What will be the output of the following program code?class LogicalCompare{ public static void main(String args[]){ String str1 = new String("OKAY"); String str2 = new String(str1); System.out.println(str1 == str2); }} 0 Displays error message false true 1 0 Displays error message false true 1 ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What will be the output?String str1 = "abcde";System.out.println(str1.substring(1, 3)); abcd abc bc bcd None of these abcd abc bc bcd None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What will be the output?public class Test{ public static void main (String[] args){ String test = "a1b2c3"; String[] tokens = test.split("\\d"); for(String s: tokens) System.out.print(s); } } 123 abc Runtime exception thrown Compilation error 123 abc Runtime exception thrown Compilation error 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 true false false true false false true true true false false true false false ANSWER DOWNLOAD EXAMIANS APP