0
Each of method have a meaning sooo What's about 'public static void'? told me eachWhat's 'public' and 'static'? 'void' I know what is it
6 Respostas
+ 7
It's three completely different things:
public means that the method is visible and can be called from other objects of other types. Other alternatives are private, protected, package and package-private.
static means that the method is associated with the class, not a specific instance (object) of that class. This means that you can call a static method without creating an object of the class.
void means that the method has no return value. If the method returned an int you would write int instead of void.
+ 2
simply
public means you can access method from everywhere.
static means you can call method without creating object.(using class)
void means method returns nothing.
0
Wow thanks very much I fell more confuse but I think I'm gonna remember it becus It must help me a lot
0
public allows you to access that function from any part of your program..
static means you can use that function without it having an instance or object of its own..
void just means when u call it no value is returned
0
Thnx all thnx I'm roger that thing
0
public means that it is open to other objects to access its "contents" and its data; to prevent this, you can make the method private to shut it off from other objects.
static means that the method belongs to the entire class and all of its objects, rather than only one object.
void is the return type: it means that that method doesn't return anything. The main method, for example, is not supposed to return anything because it is the "heart" of the program; other methods are supposed to be called from the the main method to complete a set of instructions and return a value back to the main method. In one of these "helper" methods, the return type can be any data type you need.