清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
提高代码复用性package car; public class Car { String color; int number; void run(){ System.out.println(color+"::"+number); } } class carDemo { public static void main(String[] args) { Car c = new Car(); show(c); } /* * 封装功能 * Car c = new Car(); * Car c1 = new Car(); * */ public static void show(Car cc) { cc.color = "red"; cc.number = 4; cc.run(); } }