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

📄 teacher.java

📁 《Java核心技术应用开发》电子工业出版社书籍源代码
💻 JAVA
字号:
package sample;

public class Teacher {
    
    /**properties of a teacher*/
    private String name;
    private int age;
    private double salary;
    
    
    /** Creates a new instance of Teacher */
    public Teacher(String name, int age, double salary) {
        this.salary = salary;
        this.age = age;
        this.name = name;
    }
 
    /**operations on properties */
    /** get the name of this teacher */
    public String getName() { return name; }
    /**get the salary of this teacher */
    public double getSalary() { return salary; }
    /**get the age of teacher teacher */
    public int getAge() { return age; } 
    
    public static void main(String[] args) {
        Teacher teacher = new Teacher("John Smith", 30, 10000);
        System.out.println("Teacher: " + teacher.getName());
        System.out.println("\tAge: " + teacher.getAge());
        System.out.println("\tSalary: " + teacher.getSalary());
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -