Which is true?

Given: 1. public class Foo { 2. public static void main() { 3. System.out.println(“Hello.”); 4. } 5. }
Which is true?

Given: 1. public class Foo { 2. public static void main() { 3. System.out.println(“Hello.”); 4. } 5. }
Which is true?

A.
The class Foo will run successfully when invoked with the command line:
java Foo, but will produce no output.

B.
Compilation fails.

C.
An exception occurs at runtime when class Foo is invoked with the command line java Foo.

D.
The class Foo will run successfully when invoked with the command line
java Foo, and will print “Hello.”



Leave a Reply 0

Your email address will not be published. Required fields are marked *