polymorphism.java

来自「里面包含了4个类」· Java 代码 · 共 34 行

JAVA
34
字号
/*
 * Polymorphism.java
 *
 * Created on 2000年9月23日, 下午7:33
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package newpackage.Test;

import java.io.*;
public class Polymorphism{
    public static void main(String[] args)throws IOException{
        Employee employee = null;
        int option;
        BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("1 for part-time\n2 for full-time\noption? ");
        option = Integer.parseInt(buf.readLine());
        switch(option){
            case 1:
                employee = new PartTimeEmployee();
                break;
            case 2:
                employee = new FullTimeEmployee();
                break;
            default:
                System.out.println("Unknown option");
        }
        employee.dealSalary();
    }
}

⌨️ 快捷键说明

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