Syntax in Java MCQs Exercise II

Ques 1 Syntax


What is the output of the following Java Code?


public class SmallCode{
    void main()
    {
     System.out.println("Java with SmallCode");
    }
    static void main(String args)
    {
     System.out.println("Basic Java with SmallCode");
    }
    public static void main(String[]args)
    {
     System.out.println("SmallCode");
    }
    void main(Object[] args)
    {
     System.out.println("smallcode");
    }
} 

A Java with SmallCode
B Basic Java with SmallCode
C SmallCode
D smallcode

Ques 2 Syntax


Which of the following is a valid Java identifier?

A 2variable
B variable_2
C _variable
D %variable%