JAVA Strings What will be output?String S1 = "S1 ="+ "123"+"456";String S2 = "S2 ="+(123+456); S1=579,S2=579 S1=123456,S2=123456 None of This S1=123456, S2=579 S1=579,S2=579 S1=123456,S2=123456 None of This S1=123456, S2=579 ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings String str1 = "Kolkata".replace('k', 'a');In the above statement, the effect on string Kolkata is 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. All characters a are replaced by k. Displays error message All characters k are replaced by a. ANSWER DOWNLOAD EXAMIANS APP
JAVA Strings The class string belongs to ................. package. java.string java.awt java.lang java.applet java.string java.awt java.lang java.applet 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)); }} true,true None of these false,true false,false true,false true,true None of these false,true false,false true,false 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); } } abc 123 Compilation error Runtime exception thrown abc 123 Compilation error Runtime exception thrown 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. } None of these one.two.three. Compilation fails because of an error at line 5 An exception is thrown at runtime. Compilation fails because of an error at line 3 None of these one.two.three. Compilation fails because of an error at line 5 An exception is thrown at runtime. Compilation fails because of an error at line 3 ANSWER DOWNLOAD EXAMIANS APP