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

7th Aug 2016, 7:10 AM
Very hard!
Very hard! - avatar
6 odpowiedzi
+ 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.
7th Aug 2016, 7:23 AM
Mohammad Reza Karimi
Mohammad Reza Karimi - avatar
+ 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.
7th Aug 2016, 9:04 AM
Harish Nandoliya
Harish Nandoliya - avatar
0
Wow thanks very much I fell more confuse but I think I'm gonna remember it becus It must help me a lot
7th Aug 2016, 7:55 AM
Very hard!
Very hard! - avatar
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
7th Aug 2016, 9:58 PM
Sachet Saxena
Sachet Saxena - avatar
0
Thnx all thnx I'm roger that thing
8th Aug 2016, 10:57 AM
Very hard!
Very hard! - avatar
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.
6th Nov 2016, 1:24 PM
Nikhil Kolachalama
Nikhil Kolachalama - avatar