JAVA Strings The String method compareTo() returns -1 false 1 an int value true -1 false 1 an int value true 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"); } }} Compilation fails. An exception is thrown at runtime. "2" is printed. "1" is printed. "3" is printed. Compilation fails. An exception is thrown at runtime. "2" is printed. "1" is printed. "3" 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 str1 = "one";String str2 = "two";System.out.println(str1.concat(str2)); }} two onetwo twoone one None of these two onetwo twoone one None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings What will be the output?1. public class Test{2. public static void main(String args[]){3. Object myObj = new String[]{"one", "two", "three"};4. {5. for(String s : (String[])myObj) 6. System.out.print(s + ".");7. }8. }9. } An exception is thrown at runtime. Compilation fails because of an error at line 3 one.two.three. Compilation fails because of an error at line 5 None of these An exception is thrown at runtime. Compilation fails because of an error at line 3 one.two.three. Compilation fails because of an error at line 5 None of these 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 false true true false true false false true false true true false true false false ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings The output of the following fraction of code ispublic class Test{ public static void main(String args[]){ String s1 = new String("Hello");String s2 = new String("Hellow");System.out.println(s1 = s2);}} None of these Throws an exception Hello Compilation error Hellow None of these Throws an exception Hello Compilation error Hellow ANSWER DOWNLOAD EXAMIANS APP