Skip to content
Related Articles

Related Articles

Java | Operators | Question 7

View Discussion
Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 28 Jun, 2021

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!