+ 5
public static void main(String[] arg) { ???
What is the difference between: 1. static void.... 2. static.... 3. public static void main.... 4. private void.... 5. public int.... And also how do they work when I want to code something? Sorry if I didn't catch on yet. Doesn't seem to make sense when to use them.
4 Answers
+ 25
Sololearn Java course covers up your question.
+ 4
ACCESS MODIFIERS - public/private/default/protected.
These are used to restrict a part of your code(variables/methods / class etc)
Example, If you want one of your variable to be accessible only in that class, use private before datatype..
STATIC
Declaring a part of your code as static means that it can be called directly from other classes , without creating an object first.
VOID
When we declare a method as void, it means it doesn't return anything.
If you need more help msg me.
Also try searching on the internet as that will teach you more different new things.
+ 2
Sometimes its difficult to understand Sololearn. In that case I use comment of that lesson(top right corner pf that lesson).
0
aaagg