📄 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"); //调用类成员方法
customer1.setAddress("#188 Beijing Road");//调用类成员方法
customer1.setTelephone("0571-23503545"); //调用类成员方法
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());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -