Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are the rules to name a Java file without public class defined in it?

class defined file Java public rules
0
Posted

What are the rules to name a Java file without public class defined in it?

0

A8. Everyone knows one Java file only can contain one public class, and the file must be named as the name of the public class name. But how about Java file with no public class? No restrictions on name of Java file without public class defined. If you have a class with a main, you’d better name the file with that class name for your own convenience. However, this is not required. Test this out!

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.