- A Hello
- B Hello Foo91
- C Hello world
- D The code does not run.
- Share this MCQ
Answer:
D
Share this MCQ
Option D is correct. A runtime error will occur owning to the main method of the code fragment not being declared static:
Exception in thread "main" java.lang.NoSuchMethodError: main
The Java Language Specification clearly states: "The main method must be declared public, static, and void. It must accept a single argument that is an array of strings."
Click me to Read more Question & Answer of Java Language FundamentalShare this MCQ