The function of java--public_private_void_static
For beginners, these names are familiar but not fully understood.
The following explains one by one:
public and private (these two are for permission scope)
public xxx (){} is a public method that can be called by any class.
private xxx (){} is a private method, that is, it can only be called in this class and cannot be called by any other class.
void function returns a value type (functions can return multiple types of values, such as int, String, Float, etc.)
For example, publicvoid xxx (){} returns nothing after execution of this function.
But this function can be called by any other class because public is used.
Note: If a function returns nothing, but you name it without void, eclipse automatically indicates an error.
static
static is a static function, using static means that this function belongs to the class, and there is no need to create an object when calling it.
public static void test (){}
Instead of creating an object reference with new when called in the main method, you can simply type test () to reference the function.
QQ group: 610845268