• 2022-06-01
    关于Employee类的对象说法错误的是() public class Employee{ private int age; private String name; public Employee(){ } public Employee(int age,String name){ this.age = age; this.name = name; } } public class TestEmployee{ public static void main(String[] args){ Employee e1 = new Employee(); Employee e2 = new Employee(10,"tom"); Employee e3 = e2; Employee e4 = new Employee(10,"tom"); } }
    A: e1对象的name和age属性的值是默认值null和0
    B: e2和e3指向相同的内存空间,即指向同一个对象
    C: e3和e4对象的age属性值都是10,name属性值都是"tom",所以是同一个对象
    D: 表达式e2==e3的值为true,e3==e4的值为false
  • C

    举一反三

    内容

    • 0

      ‎阅读以下程序,说明Company类和Employee类是 关系。‎‎public class Company{ private Employee employee; public Employee getEmployee(){ return employee; } public void setEmployee(Employee employee){ this.employee=employee; } //公司运作 public void run(){ employee.startWorking(); } }‎

    • 1

      下面程序运行的结果是 struct Student { public int age; public string name; public Student(int age, string name) { this.age = age; this.name = name; } } class Program { static void Main(string[] args) { Student stu1 = new Student(18, "小方"); Student stu2 = new Student(24, "小刚"); stu2 = stu1; stu1.age = 30; stu1.name = "小燕"; Console.WriteLine("{1},{0}",stu2.age,stu2.name); } }

    • 2

      存在Employee类,如何创建一个长度为3的Employee类型数组?() A: Employee[3]e; B: Employee[]e=newEmployee[3]; C: Employeee[3]; D: Employee[3]e=newEmployee[];

    • 3

      在C#中,下列结构或者类定义正确的是(选一项) A: public struct Person{ string name; int age; public void ShowName(){ Console.WriteLine(name); }} B: public struct Person{ string name; int age; public Person(){ Conssole.WriteLine(name); }} C: public class Person{ string name; int age; public Person(){ Conssole.WriteLine(name); }} D: public class Person{ string name; int age; public Person(string name){ Conssole.WriteLine(name); }}

    • 4

      如果要插入一条员工数据,则下列选项正确的是() A: INSERT INTO Employee(Name,Gender,Age,Rank) values('张朝阳','男',48,'201') B: INSERT INTO Employee(Name,Gender,Age,Rank) values(“张朝阳”,”男”,48,”201”) C: INSERT INTO Employee(Name,Gender,Age) values(‘张朝阳','男',48,'201') D: INSERT INTO Employee(Name,Gender,Age,Rank) value(‘张朝阳','男',48,'201')