M
Q. What is the output of the following code snippet?
String s1 = “Hello”; String s2 = “Hello”; System.out.println(s1 == s2);
In Java, when two string literals are created with the same value, they refer to the same object in memory. Therefore, s1 and s2 both refer to the same “Hello” string object. The == operator checks if two variables refer to the same object in memory, so s1 == s2 returns true.
You must be Logged in to update hint/solution
Q. What does the operator >>>> do?
Q. At runtime, error is recoverable.
Q. Which of these maintains insertion order?
Q. Which of this keyword can be used in a subclass to call the constructor of superclass?
Q. In Java, which data type is used to store numbers with decimal points?
Q. An ENUM type in Java is like a ____.
Q. what is the output of below java program?
Q. Single character in java is called _____literals.
Q. Select from among the following character escape code which is not available in Java.
Discusssion
Login to discuss.