String S1 = "S1 ="+ "123"+"456"; String S2 = "S2 ="+(123+456);
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)); } }
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. }
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"); } } }
String str1 = "Kolkata".replace('k', 'a');
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); } }
String a = new String("Examveda"); String b = new String("Examveda"); String c = "Examveda"; String d = "Examveda";
String str1 = "abcde"; System.out.println(str1.substring(1, 3));
String str1 = "Hellow"; System.out.println(str1.indexOf('t'));
public class Test{ public static void main(String args[]){ String str1 = "one"; String str2 = "two"; System.out.println(str1.concat(str2)); } }
Please disable the adBlock and continue. Thank you.