JAVA Strings What will be the output?String str1 = "abcde";System.out.println(str1.substring(1, 3)); bc None of these bcd abcd abc bc None of these bcd abcd abc 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 Compilation error Runtime exception thrown abc 123 Compilation error Runtime exception thrown abc ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings The String method compareTo() returns 1 an int value false true -1 1 an int value false true -1 ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings String str1 = "Kolkata".replace('k', 'a');In the above statement, the effect on string Kolkata is Displays error message All characters k are replaced by a. All characters a are replaced by k. The first occurrence of k is replaced by a. Displays error message All characters k are replaced by a. All characters a are replaced by k. The first occurrence of k is replaced by a. ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What will be the output of the following program code?public class Test{ public static void main(String args[]){ String s = "what"; StringBuffer sb = new StringBuffer("what"); System.out.print(sb.equals(s)+","+s.equals(sb)); }} false,true true,false true,true None of these false,false false,true true,false true,true None of these false,false 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 1 true false 0 Displays error message 1 true false ANSWER DOWNLOAD EXAMIANS APP