class Car { int num; String name; String color; public static void run() { System.out.println("行驶中"); } } //再类中定义的变量:成员变量 //在类中定义的函数:成员函数 class Demo1 { public static void main(String[] args) { //创建一个car对象 Car benchi = new Car(); //成员访问符 benchi.num = 4; benchi.color = "白色"; benchi.name = "奔驰"; System.out.print(benchi.num+ "量" + benchi.color+"的" + benchi.name); benchi.run(); } }