- 2

Why is public static void is used in java coding and what it mean

Q related java coding

23rd May 2017, 1:18 PM
Preet Shah
Preet Shah - avatar
1 Answer
+ 6
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. The combination of all three of these is most commonly seen on theĀ mainĀ methodĀ 
23rd May 2017, 1:30 PM
Eremie Gillowei
Eremie Gillowei - avatar