为使下列代码正常运行,应该在下划线处填入的选项是 ObjectInputStream in= new_____(new FileInputStream(“employee . dat”)); Employee[]newStaff=(Employee[〕) in.readObject(); in .cIose();
举一反三
- 为使下列代码正常运行,应该在下划线处填入的选项是 A: Reader B: InputStream C: ObjectInput D: ObjectInputStream
- 有如下类的定义,创建Employee对象正确的是() public class Employee{ private int age; private String name; public void Employee(){ } public Employee(int age){ this.age = age; } public Employee(String name){ this.name = name; } } A: Employee e = new Employee( ) B: Employee e = new Employee(10); C: Employee e = new Employee(tom); D: Employee e = new Employee(10,"tom");
- 为使下列代码正常运行,应该在下划线处填入的选项是()
- 有如下类的定义,创建Employee对象错误的是() public class Employee{ private int age; private String name; public Employee(int age){ this.age = age; } public Employee(String name){ this.name = name; } public Employee(int age,String name){ this(age); this.name = name; } } A: Employee emp = new Employee(10); B: Employee emp = new Employee("Tom"); C: Employee emp = new Employee(); D: Employee emp = new Employee(10,"Tom");
- 已知:class Employee;class Manager extends Employee;class Director extends Employee;则以下语句能通过编译的有哪些? A: Employee e = new Manager(); B: Director d = new Manager(); C: Director d = new Employee(); D: Manager m = new Director()