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"); } }} "3" is printed. "1" is printed. Compilation fails. An exception is thrown at runtime. "2" is printed. "3" is printed. "1" is printed. Compilation fails. An exception is thrown at runtime. "2" is printed. 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); } } Compilation error Runtime exception thrown 123 abc Compilation error Runtime exception thrown 123 abc ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings toString() method is defined in java.lang.Object java.lang.String None of these java.lang.util java.lang.Object java.lang.String None of these java.lang.util ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What could be output of the following fragment of code?public class Test{ public static void main(String args[]){ String x = "hellow";int y = 9;System.out.println(x += y); } } hellow9 9hellow Throws an exception as string and int are not compatible for addition Compilation error None of these hellow9 9hellow Throws an exception as string and int are not compatible for addition Compilation error None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings The class string belongs to ................. package. java.applet java.string java.lang java.awt java.applet java.string java.lang java.awt ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What is the output of the following println statement?String str1 = "Hellow";System.out.println(str1.indexOf('t')); true false 0 1 -1 true false 0 1 -1 ANSWER DOWNLOAD EXAMIANS APP