Which of the following statements is true about mutable and immutable strings in Java?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
What is the difference between StringBuffer and StringBuilder in Java?
Which of the following methods is used to concatenate two strings in Java?
What is the output of the following code snippet?
String str = "Hello";
str += " World";
System.out.println(str);
What is the output of the following code snippet?
String str1 = "Hello";
String str2 = "Hello";
System.out.println(str1 == str2);
What is the output of the following code snippet?
String str = "Hello";
str.replace('H', 'J');
System.out.println(str);
What is the output of the following code snippet?
String str = "Hello";
String newStr = str.toUpperCase();
System.out.println(newStr);
What is the output of the following code snippet?
String str = "Hello World";
String[] words = str.split(" ");
System.out.println(words.length);
What is the output of the following code snippet?
String str = "Hello";
StringBuffer sb = new StringBuffer(str);
sb.append(" World");
System.out.println(sb);
What is the output of the following code snippet?
String str1 = "Java";
String str2 = new String("Java");
System.out.println(str1 == str2);
What is the output of the following code snippet?
String str = "Hello";
str.concat(" World");
System.out.println(str);
What is the output of the following code snippet?
StringBuffer sb = new StringBuffer("Hello");
sb.reverse();
System.out.println(sb);
What is the output of the following code snippet?
String str1 = "Hello";
String str2 = "Hello";
System.out.println(str1.equals(str2));
What is the output of the following code snippet?
StringBuilder sb = new StringBuilder("Hello");
sb.delete(1, 3);
System.out.println(sb);
60 videos|37 docs|12 tests
|
60 videos|37 docs|12 tests
|