What is the result of the command
javac test.java
if file test.java contains:

// test.java
/* comments */
There is a requirement for public classes - they should be placed in a file with a name that matches the name of the class. But it is not required to have a class with the same name in a file. Any non-public classes or comments (as in this question) can be n the .java file. The file may be even empty - and, nevertheless, the compiler will process it correctly.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Sign Up Now
or Subscribe for future quizzes