java in the public void What does it mean

The most basic syntax:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

java is in the public access modifier class, void is a type of empty, no data is returned.

public void for the rest method, indicating that the method can be accessed in the project, no return value.

public access modifier is class, marking a class of your own definition, the bag can then access, public (public) where you can access the private (private) throughout the project in this category can only use protected (protected) in subclasses and under the same package can access the class as well as on the default access modifier, accessible only in the same package.

Extended Information:

Java is an object-oriented programming language, not only absorbed the various advantages of the C ++ language, but also abandoned the multiple inheritance in C ++ incomprehensible concepts such as pointers, so the Java language has a powerful and easy to use two features.

JAVA in public: the meaning of the public: members under, is a public member of the class, another class or the main function can be accessed directly declare objects, while private: is under private members, internal access only class, class external inaccessible.

Guess you like

Origin www.cnblogs.com/mo3408/p/12148314.html