java初学者,求大神指教:数组和方法的使用2
1.定义数组,存储1-100(包括1和100)之间所有能被7整除的数字2.定义方法,传递数组,计算数组元素最大值并将结果返回3.定义方法,传递数组,计算数组元素最小值并将...
1.定义数组,存储1-100(包括1和100)之间所有能被7整除的数字
2.定义方法,传递数组,计算数组元素最大值并将结果返回
3.定义方法,传递数组,计算数组元素最小值并将结果返回
3.定义方法,传递数组及最大值,最小值,将最大值和最小值进行交换,并打印交换后的数组*/ 展开
2.定义方法,传递数组,计算数组元素最大值并将结果返回
3.定义方法,传递数组,计算数组元素最小值并将结果返回
3.定义方法,传递数组及最大值,最小值,将最大值和最小值进行交换,并打印交换后的数组*/ 展开
展开全部
public class good {
private String name;
private String number;
private String type;
private Double price;
private String describe;
public good(String name, String number, String type, Double price,
String describe) {
super();
this.name = name;
this.number = number;
this.type = type;
this.price = price;
this.describe = describe;
}
public good() {
super();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
}
然后拿着商品对象操作就行了,如果需要在控制台打印还要重写toString()方法
private String name;
private String number;
private String type;
private Double price;
private String describe;
public good(String name, String number, String type, Double price,
String describe) {
super();
this.name = name;
this.number = number;
this.type = type;
this.price = price;
this.describe = describe;
}
public good() {
super();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
}
然后拿着商品对象操作就行了,如果需要在控制台打印还要重写toString()方法
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询