- public class Car{
- String color;//成员变量、实例变量
- static int num;//静态变量、类变量
- Car(){
- num=4;
- color="red";
- }
- public static void main(String args[]){
- Car ca=new Car();
- run(ca);
- }
- static void run(Car a){
- int jubu=8; //局部变量
- System.out.print(a.num+","+a.color+","+jubu);
- }
- }
复制代码 附上代码 |