已知类型的声明: public class Employee extends Object{ int id; String name; } 请将下面语句补充完整, Object o1 = new Employee(); Object o2 = new Employee(); Employee e1 = ( )o1; Employee e2 = ( )o2; e1.name = "zhangsan"; e2.name = "lisi"; if( ){ System.out.println("两位员工姓名相同!"); }
时间: 2023-05-31 20:04:15 浏览: 76
Employee e1 = (Employee) o1;
Employee e2 = (Employee) o2;
if(e1.name.equals(e2.name)){
System.out.println("两位员工姓名相同!");
}
阅读全文