Java程序设计,创建一个汽车类CarModel.java,

它里面有2个不同的构造函数,CarManufactory.java可以应用这些构造方法创建不同类型的汽车CarModel.java设计要求如下:定义style(Strin... 它里面有2个不同的构造函数,CarManufactory.java可以应用这些构造方法创建不同类型的汽车 CarModel.java设计要求如下: 定义style(String),color(String),category(String)注:括号中为变量类型 创建第一个构造函数,分别给以上变量赋值,要求为该构造函数定义三个形参,分别赋给相应的变量,形参的值在对象创建时给出 创建第二个构造函数,此构造函数过程为空 定义三个方法,分别返回style,color,cat 展开
 我来答
匿名用户
2014-10-23
展开全部
public class CarManufactory{
private String style;
private String color;
private String category;

public String getStyle(){
return this.style;
}
public String getColor(){
return this.color;
}
public String getCategory(){
return this.category;
}

public CarManufactory(String style,String color,String category){
this.style = style;
this.color = color;
this.category = category;
}
public CarManufactory(){}
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
道旁
推荐于2016-08-17
知道答主
回答量:31
采纳率:0%
帮助的人:19.6万
展开全部
public class CarManufactory {
private String style;
private String color;
private String category;
public CarManufactory(String style, String color, String category) {
super();
this.style = style;
this.color = color;
this.category = category;
}
public CarManufactory() {
super();
// TODO Auto-generated constructor stub
}
public String getStyle() {
return style;
}
public String getColor() {
return color;
}
public String getCategory() {
return category;
}
}
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2014-10-23
展开全部
public class CarModel{

private String style;
private String color;
private String category;

public CarModel(String style, String color, String category) {
this.style = style;
this.color = color;
this.category = category;
}

public CarModel(){}

public String getStyle() {
return style;
}

public String getColor() {
return color;
}

public String getCategory() {
return category;
}

}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式