?? customer.java
字號:
//Customer.java
class Customer{
String name, address, telephone; //定義成員變量
//定義成員方
String getName(){
return name;
}
String getAddress(){
return address;
}
String getTelephone(){
return telephone;
}
void setName(String name){
this.name = name;
}
void setAddress(String address){
this.address = address;
}
void setTelephone (String telephone){
this.telephone = telephone;
}
public static void main(String[] args){
Customer customer1 = new Customer();//實例化Customer類對象customer1
customer1.setName("Wang Ming"); //調(diào)用類成員方法
customer1.setAddress("#188 Beijing Road");//調(diào)用類成員方法
customer1.setTelephone("0571-23503545"); //調(diào)用類成員方法
System.out.print("The customer is ");
System.out.println(customer1.getName());
System.out.print("The customer address is ");
System.out.println(customer1.getAddress());
System.out.print("The customer telephone is ");
System.out.println(customer1.getTelephone());
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -