Open In App

Java | Operators | Question 7

Like Article
Like
Save
Share
Report




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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads