⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customer.java

📁 java程序设计 清华出版社 孙燮华老师编写的程序源代码
💻 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 + -