Skip to content
Related Articles

Related Articles

Java | Operators | Question 7
  • Difficulty Level : Basic
  • Last Updated : 19 Nov, 2015

class Test
    public static void main(String args[])
        String s1 = "geeksquiz";
        String s2 = "geeksquiz";
        System.out.println("s1 == s2 is:" + s1 == s2);

(A) true
(B) false
(C) compiler error
(D) throws an exception

Answer: (B)

Explanation: The output is “false” because in java + operator precedence is more than == operator. So the given expression will be evaluated to “s1 == s2 is:geeksquiz” == “geeksquiz” i.e false.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :