+ 1
Where to use the static in Java..?
5 Respostas
+ 3
Nitin Jibhau Gangurde The static keyword is can be used with variable, method, block, and class. It is used to manage the memory in java. The static keyword always belongs to class instead of objects.
+ 2
In Java, static keyword is mainly used for memory management.
+ 1
To run your code,
+ 1
About Class, static method and variable.
Remeber you need create a object?
Person peopleOne = new People("My name"), for example..
In class Person have: String name;
each people have different name.
calling the name of one person: peopleOne.name;
Now imagine every time you create a Person you want save how many are created. So it is not for the unique Person.
You can create: static int quantit;
Call: PersonClass.quantit;
I don't need create any person to use it.
For me it's most different, you can use static method and variable without creating a object.
0
Thanks