What is the output of the following println statement?String str1 = "Hellow";System.out.println(str1.indexOf('t')); true 1 false -1 0 TRUE ANSWER : ? YOUR ANSWER : ?
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 onetwo twoone two TRUE ANSWER : ? YOUR ANSWER : ?
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"); } }} "1" is printed. "3" is printed. "2" is printed. Compilation fails. An exception is thrown at runtime. TRUE ANSWER : ? YOUR ANSWER : ?
toString() method is defined in java.lang.String java.lang.Object java.lang.util None of these TRUE ANSWER : ? YOUR ANSWER : ?
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,true None of these false,false true,false TRUE ANSWER : ? YOUR ANSWER : ?
Determine output:public class Test{ public static void main(String args[]){ String s1 = "SITHA";String s2 = "RAMA";System.out.println(s1.charAt(0) > s2.charAt(0)); }} false 0 Throws Exception Compilation error true TRUE ANSWER : ? YOUR ANSWER : ?
What will be output?String S1 = "S1 ="+ "123"+"456";String S2 = "S2 ="+(123+456); None of This S1=123456,S2=123456 S1=123456, S2=579 S1=579,S2=579 TRUE ANSWER : ? YOUR ANSWER : ?
String str1 = "Kolkata".replace('k', 'a');In the above statement, the effect on string Kolkata is Displays error message The first occurrence of k is replaced by a. All characters k are replaced by a. All characters a are replaced by k. TRUE ANSWER : ? YOUR ANSWER : ?
What will be the output?String str1 = "abcde";System.out.println(str1.substring(1, 3)); bcd None of these bc abc abcd TRUE ANSWER : ? YOUR ANSWER : ?