Menu
Question Index
...

What will be the output of the following program?

public class Name {
    static String name;
    public static void main(String args[]) {
        if (name.equals("Java"))
            System.out.println("true");
        else
            System.out.print("false");
    }
}


true
false
Runtime Error because of java.lang.NullPointerException
Runtime Error because of java.lang.IllegalStateException
Runtime Error because of java.lang.IllegalArgumentException

Doubts

Problems

Topic: Java equals method vs == Operator

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App