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].
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!