Which of the following is not syntactically legal in Java?

Which of the following is not syntactically legal in Java?

a) public class Foo
b) System.out.println("Hi");
c) { }
d) s t a t i c main(String[ ] args)
e) only b is legally valid, all of the rest are illegal

Answer:  d.

Explanation:  The Java compiler would not recognize “s t a t i c” as “static” because the Java compiler treats white space (blanks) as separators between entities.  The other statements are all legal, including “{ }” which is a block that happens to have no statements within it.


Java

Learn More Multiple Choice Question :