FileName. JAVA) can only match the name of the public class in the file

Source: Internet
Author: User

1. If the class Yuangong is declared public, the class Yuangong must be saved in the name Yuangong . java files;
2, conversely, a file contains a maximum of a top-level public class, and the public class name is the same as the file name. For example, in file yuangong . Java, one or more classes are allowed to be defined, but a maximum of one top-level public class is allowed, and this class is named yuangong . The top-level emphasis here means allowing non-top-level public classes to exist, such as internal public classes.
simply put, there can be at most one class in a file that is public, so that you can expose the definition of a class and make it easier for other classes to access it! If you already have this public class, the file name must be the same as the class name! because of yourAbstractdemois already public modified, so remove the other two classes of public, save the file name is abstractdemo . Java

FileName. JAVA) can only match the name of the public class in the file

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.