0
What is the meaning of "java static"?
Static in java
3 odpowiedzi
+ 16
• Static or class fields belong to a class, not to an object
class Point{
double x;
double y;
static double xorigin = 0.0;
static double yorigin = 0.0;
}
System.out.println(
"The origin is at ("+
Point.xorigin +", "+
Point.yorigin +")" );
You access class variables with the name of the class rather than a reference variable.
+ 12
Variables and methods marked 'static' belong to the class, rather than to any particular instance. In fact, you can use a 'static' method or variable without having any instances of that class at all. You need only have the class available to be able to invoke a 'static' method or access a 'static' variable. 'static' variables, too, can be accessed without having an instance of a class. But if there are instances, a 'static' variable of a class will be shared by all instances of that class; there is only one copy.
https://code.sololearn.com/W2LnAYam75y4/?ref=app
0
Some people say.. "Static" means "UNCHANGED" ?