Exercise (Solutions)

E1

Study the below class:


class MyClass {

    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

Observe the indentation for System.out.println statement. Figure out why it has two tab indentation. Explain your answer.

E2

What is wrong with this class definition?

class MySecondClass (

)

E3

What is wrong with this class definition?

classMyThirdClass {

}

E4

Write the method signature that is required in a Java class to run that class using 'java' from the terminal?

E5

What must a statement end with?

results matching ""

    No results matching ""