标签:main 圆形 构造 包含 highlight spl 上海 png alt
//D:\java\object\Functions\include\Bike.java; package include; public class Wheel{ public String color; public int size; public String lunzi; public Wheel(){ } public Wheel(String color,int size,String lunzi){ this.color=color; this.size=size; this.lunzi=lunzi; }//构造方法重载 public void run(){ System.out.println("随意方向旋转"); } }
//D:\java\object\Functions\include\Wheel.java; package include; public class Wheel{ public String color; public int size; public String lunzi; public Wheel(){ } public Wheel(String color,int size,String lunzi){ this.color=color; this.size=size; this.lunzi=lunzi; }//构造方法重载 public void run(){ System.out.println("随意方向旋转"); } }
//D:\java\object\Functions\include\Test.java; package include; public class Test{ public static void main(String[] args){ /* Bike a=new Bike(); a.color="黑色"; a.brand="凤凰牌"; a.type="24式"; a.lee=new Wheel(); a.lee.color="黄色"; a.lee.size=240; a.lee.lunzi="圆形"; a.display(); */ Bike c=new Bike("上海牌","红色","14寸",new Wheel("黑色",140,"圆环形")); c.display(); } }
标签:main 圆形 构造 包含 highlight spl 上海 png alt
原文地址:https://www.cnblogs.com/canglongdao/p/12826513.html