Programming Language › Java Control Flow › Question #2139
Single Choice Not Set

QConsider the following program written in Java.
class Test{
        public static void main(String args[]){
                int x=7; 
                if(x==2); // Note the semicolon
                System.out.println("NumberSeven");
                System.out.println("NotSeven");
        }
}
What would the output of the program be?

ID: #2139 Java Control Flow 1,301 views
Question Info
#2139Q ID
Not SetDifficulty
Java Control FlowTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A NumberSeven NotSeven ✔ ✖
  • B NumberSeven ✔ ✖
  • C NotSeven ✔ ✖
  • D Error ✔ ✖
Correct Answer

Explanation

NumberSeven NotSeven

Share This Question

Challenge a friend or share with your study group.