Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Java | Operators | Question 7

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article




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
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads