What does midpoint mean in java?
For example, the following program:
public class Cat { private static int sid = 0; private String name; int id; Cat(String name) { this.name = name; id = sid++; } public void info(){ System.out.println ("My name is "+name+" No."+id); } public static void main(String arg[]){ Cat.sid = 100; Cat mimi = new Cat("mimi"); mimi.sid = 2000; Cat pipi = new Cat("pipi"); mimi.info(); pipi.info(); } }
In this program, Cat.sid = 100 What does the dot in this sentence mean?
Cat is a class, which defines member variables and member functions. The operation at the middle point of Cat.sid is to call the member variables.
Ordinary member variables and member functions must be operated with the object name (such as mimi.sid in the above example), but for static variables and functions, all objects of a class are common, so they can be directly operated by the class name to operate (such as Cat.sid in the above example).
The above is the detailed content of What does midpoint mean in java. For more information, please follow other related articles on the PHP Chinese website!