Here are 10 essential multiple-choice questions on Java String Basics, covering key concepts.
Question 3
What will be the output of the following code?
String s1 = "Java";
String s2 = "Java";
System.out.println(s1 == s2);
Question 4
What will be the output of the following code?
String s1 = new String("Java");
String s2 = new String("Java");
System.out.println(s1 == s2);
Question 6
What will be the output of the following code?
String s = "Hello";
s.concat(" World");
System.out.println(s);
Question 8
What will be the output of the following code?
String s1 = "Hello";
String s2 = s1.concat(" World");
System.out.println(s2);
Question 10
What is the advantage of using String over StringBuilder in multi-threaded applications?
There are 10 questions to complete.
Quiz about Java String Basics