Home  >  Article  >  Java  >  What are the java member variables?

What are the java member variables?

coldplay.xixi
coldplay.xixiOriginal
2021-01-11 10:10:4413644browse

Java member variables include: 1. Instance variables [String id, private String colorType]; 2. Class variables [private static String depart]; 3. Constants [final String design=yang].

What are the java member variables?

The operating environment of this tutorial: windows7 system, java10 version, DELL G3 computer. This method is suitable for all brands of computers.

java member variables include:

Instance variables, class variables, and constants all belong to member variables

Local variables, also called internal variables, refer to Variables defined within a function or within a compound statement

public class Clothes{
    String id;                      //实例变量
    private String colorType;       //实例变量
    private int size;               //实例变量
    private static String depart;   //类变量
    final String design="yangzi";   //常量
    public void a(int num){ }       //局部变量
}

Related free learning recommendations:java basic tutorial

The above is the detailed content of What are the java member variables?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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