A Java source file that can have more than one class, but only a public-decorated class

Source: Internet
Author: User

Each Java source file is a writing unit for a Java compiler. Each time the compiler writes a. java file (a compilation unit), it outputs many of the From class files that correspond to the names of the Java file classes, not just the public adornments. However, the public class is the open interface that is used to compile the unit existence. If not, the run will error, indicating that the loaded class could not be found.

Public is the equivalent of a main class. But there can only be one main class, and the name is the same as the Java source file name, as the only interface.

A Java source file that can have more than one class, but only a public-decorated class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.