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

// test.java
/* comments */
Explanation
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.

@nastya I think it's a typo; it should be "in" not "n".

2023 Jun 13, 5:27:30 PM

Any non-public classes or comments (as in this question) can be n the .java file. ??? What does 'n' mean?

2023 Apr 25, 4:04:03 PM

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты