Home > Java > javaTutorial > What does midpoint mean in java

What does midpoint mean in java

藏色散人
Release: 2019-06-01 09:23:10
Original
8097 people have browsed it

What does midpoint mean in java

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();
}
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template