java题,求大神解答 - 爱问答

(爱问答)

java题,求大神解答

class Auto {public int 轮胎数量;public String 汽车颜色;public double 车身重量;public double 速度;Auto() {// 无参构造}Auto(int 轮胎数量, String 汽车颜色, double 车身重量, double 速度) {// 有参构造this.轮胎数量 = 轮胎数量;this.汽车颜色 = 汽车颜色;this.车身重量 = 车身重量;this.速度 = 速度;}

Auto 类:

public class Auto {

private int num;//轮胎个数

private String coler; //颜色

private double weight; //重量

private double move; //速度

 

public Auto(){}

public Auto(int num){

 this.num = num;

}

public Auto(double weight){

 

 this.weight = weight;

}

public Auto(String coler){

 this.coler = coler;

}

 

public int getNum() {

 return num;

}

public void setNum(int num) {

 this.num = num;

}

public String getColer() {

 return coler;

}

public void setColer(String coler) {

 this.coler = coler;

}

public double getWeight() {

 return weight;

}

public void setWeight(double weight) {

 this.weight = weight;

}

public double getMove() {

 return move;

}

public void setMove(double move) {

 this.move = move;

}

 

}

实例化类:

public class Test {

 

 Auto a = new Auto();

 Auto a1 = new Auto(1);

 Auto a2 = new Auto("red");

 Auto a3 = new Auto(3.0);

 

}


相关标签:大神java

下一篇:景区标识系统分几类?

上一篇:23D4转十六进制转二进制

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?