Syntax in Java MCQs Exercise I

Ques 1 Syntax


Correct Syntax of Printing "Hello World"?

A System.out.println("Hello World");
B system.out.println("Hello World");
C System.Out.println("Hello World");
D All of these

Ques 2 Syntax


What is the correct way to declare a constant variable in Java?

A constant int x = 5;
B final int x = 5;
C int constant x = 5;
D int x = constant 5;

Ques 3 Syntax


What does the static keyword mean in Java?

A It indicates that a method returns no value.
B It indicates that a class cannot be inherited.
C It indicates that a variable is immutable.
D It indicates that a method can be accessed without creating an instance of the class.