+ 6

I still don't understand what Static, Void and Public...

4th Sep 2016, 9:37 PM
Oluwole Damilola Israel
Oluwole Damilola Israel - avatar
7 Réponses
+ 7
When you declare a method or an attribute as static, it basically means that you don't have to create an instance of that particular class in order to access that particular method or attribute rather it belongs to the class. Furthermore you can access that method or attribute via the class name. When a method is delcared as void, you're basically saying "i don't want to return anything for this method ". When public is used with classes, methods or attributes. This means that its visible/ accessible by any other class regardless of the package but bare in mind, in order to access a class in a different package you need to import it.
4th Sep 2016, 11:37 PM
Ousmane Diaw
+ 3
Public means the method is visible and can interact with other types of objects. Void means that it does not have a return value. Static means that the is associated with the class. -snoɯʎuou∀
4th Sep 2016, 10:14 PM
Kevin McMinn
Kevin McMinn - avatar
0
Static: if you use static then no need to create an object for it, Void : it returns nothing, it is used when we don't want to return anything, Public : if the class, methods or attributes is defined as public, it can be accessed anywhere by creating an object for it
28th Nov 2016, 11:25 AM
Pavankumar V
Pavankumar V - avatar
0
void is doesn't return the any value of tha OS .The c,c++ has been return the 0 to os
30th Jan 2017, 9:04 PM
S.Sakthieswaran
S.Sakthieswaran - avatar
- 1
void just avoid any returns static non active means no instances created
6th Sep 2016, 12:00 PM
belinda
- 5
عوز اتعلم لغة java
4th Sep 2016, 9:45 PM
Alaa Wahba
Alaa Wahba - avatar
- 6
hi
4th Sep 2016, 9:44 PM
Alaa Wahba
Alaa Wahba - avatar