展开全部
这种题太简单了吧
public class Bicycle {
private String brand = "未知品牌";
private int price = 0;
private String productData = "尚无日期";
public Bicycle() {}
public Bicycle(String brand, int price, String productData) {
this.brand = brand;
this.price = price;
this.productData = productData;
}
public void showInfo() {
System.out.println("brand: "+brand);
System.out.println("price: "+price);
System.out.println("productData: "+productData);
}
public void setBrand(String brand) {
this.brand = brand;
}
public void setPrice(int price) {
this.price = price;
}
public void setProductData(String productData) {
this.productData = productData;
}
}
public class BicycleDemo {
public static void main(String[] args) {
Bicycle bicycle1 = new Bicycle();
Bicycle bicycle2 = new Bicycle("凤凰",100,"2013/06/19");
bicycle1.showInfo();
bicycle2.showInfo();
}
}
public class Bicycle {
private String brand = "未知品牌";
private int price = 0;
private String productData = "尚无日期";
public Bicycle() {}
public Bicycle(String brand, int price, String productData) {
this.brand = brand;
this.price = price;
this.productData = productData;
}
public void showInfo() {
System.out.println("brand: "+brand);
System.out.println("price: "+price);
System.out.println("productData: "+productData);
}
public void setBrand(String brand) {
this.brand = brand;
}
public void setPrice(int price) {
this.price = price;
}
public void setProductData(String productData) {
this.productData = productData;
}
}
public class BicycleDemo {
public static void main(String[] args) {
Bicycle bicycle1 = new Bicycle();
Bicycle bicycle2 = new Bicycle("凤凰",100,"2013/06/19");
bicycle1.showInfo();
bicycle2.showInfo();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class BicycleDemo {
public static void main(String[] args) {
Bicycle b1 = new Bicycle("吉安待",3600,"2015/12/29");
Bicycle b2 = new Bicycle("宝马",70000,"2010/10/10");
b1.showInfo();
b2.showInfo();
}
}
class Bicycle{
private String brand;
private int price;
private String productDate;
public Bicycle(){
}
public Bicycle(String brand, int price, String productDate){
this.brand = brand;
this.price = price;
this.productDate = productDate;
}
public void showInfo(){
System.out.println("品牌: "+this.brand+", 价格: "+this.price+", 生产日期: "+this.productDate);
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-12-21
展开全部
public class Bicycle{
//三个成员变量
private String brand;
private int price;
private String productDate;
//输出信息方法
public void showinfo(){
System.out.println("Brand:"+brand+"price:"+price+"productDate:"+productDate);
}
//无参构造函数
public Bicycle(){
}
//有参构造函数
public Bicycle(String brand, int price,String productDate){
}
}
//采纳后给你最后一题
//三个成员变量
private String brand;
private int price;
private String productDate;
//输出信息方法
public void showinfo(){
System.out.println("Brand:"+brand+"price:"+price+"productDate:"+productDate);
}
//无参构造函数
public Bicycle(){
}
//有参构造函数
public Bicycle(String brand, int price,String productDate){
}
}
//采纳后给你最后一题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询