62,614
社区成员
发帖
与我相关
我的任务
分享
<%!
class CellPhone {
private String phoneType;
private String phoneModel;
private int phonePrice;
public String getPhoneModel() {
return phoneModel;
}
public void setPhoneModel(String phoneModel) {
this.phoneModel = phoneModel;
}
public int getPhonePrice() {
return phonePrice;
}
public void setPhonePrice(int phonePrice) {
this.phonePrice = phonePrice;
}
public String getPhoneType() {
return phoneType;
}
public void setPhoneType(String phoneType) {
this.phoneType = phoneType;
}
%>
<%
CellPhone myphone = new CellPhone();
myphone.setPhoneModel("Siemens");
myphone.setPhonePrice(500);
myphone.setPhoneType("s2588");
%>
移动电话: <br>
品牌: <%= myphone.getPhoneModel()%>
型号: <%= myphone.getPhonePrice()%>
价格: <%= myphone.getPhoneType()%>
package com.ccit.ra.test;
public class CellPhone {
private String phoneType;
private String phoneModel;
private int phonePrice;
public String getPhoneModel() {
return phoneModel;
}
public void setPhoneModel(String phoneModel) {
this.phoneModel = phoneModel;
}
public int getPhonePrice() {
return phonePrice;
}
public void setPhonePrice(int phonePrice) {
this.phonePrice = phonePrice;
}
public String getPhoneType() {
return phoneType;
}
public void setPhoneType(String phoneType) {
this.phoneType = phoneType;
}
public static void main(String[] args) {
CellPhone myphone = new CellPhone();
myphone.setPhoneModel("Siemens");
myphone.setPhonePrice(500);
myphone.setPhoneType("s2588");
System.out.println(myphone.getPhoneModel());
System.out.println(myphone.getPhonePrice());
System.out.println(myphone.getPhoneType());
}
}