Home > Back-end >  Seek bosses help me and explain what is the difference between private and public stasic void
Seek bosses help me and explain what is the difference between private and public stasic void

Time:10-07

When defining methods of either in the public static either in private void, this have what different? There is a problem is to make the picture to add on the jlabel, when you need to use seticon, when not needed?

CodePudding user response:

The format of the method is:
Modifier list return value type method name (in the form of argument list) {
Method body code;
}
Public static modifiers, so the public static two together form the list of the modifier, said the public and static, so use public static modified is class level method, also called static method, this method is called, direct: the name of the class. The method name (argument list);
Private void, only the private modifier, void return value types, so this method, the modifier list only in private, the return value type is void,
What is the meaning of void? Void is not return a value of type, is a void method, there is no return value, that is, no return... ; This kind of code, you get it

CodePudding user response:

In addition, the meaning of the private, private, use the word modified method or member variables, can only be accessed in the current class, not to be access to other class, it also embodies the encapsulation of one of the three features of Java

CodePudding user response:

Understand, and also want to ask me to send the first picture annotation set jL for//what is the meaning of the size of the? I dropped my comments that found running results did not change the

CodePudding user response:

reference 1/f * King reply:
the format of the method is:
Modifier list return value type method name (in the form of argument list) {
Method body code;
}
Public static modifiers, so the public static two together form the list of the modifier, said the public and static, so use public static modified is class level method, also called static method, this method is called, direct: the name of the class. The method name (argument list);
Private void, only the private modifier, void return value types, so this method, the modifier list only in private, the return value type is void,
What is the meaning of void? Void is not return a value of type, is a void method, there is no return value, that is, no return... ; This kind of code, you get it
thank you very much

CodePudding user response:

This is the difference between the static method and private methods luo
  • Related