• 2021-04-14 问题

    class Person { int age; public Person(int age) { ______________//让局部变量的age给成员变量的age赋值 } public int getAge() { return this.age; } } 在横线处填入正确的代码,可以让局部变量的age给成员变量的age赋值

    class Person { int age; public Person(int age) { ______________//让局部变量的age给成员变量的age赋值 } public int getAge() { return this.age; } } 在横线处填入正确的代码,可以让局部变量的age给成员变量的age赋值

  • 2021-04-14 问题

    分析下面的程序,输出的结果是? public class Test { public static void main(String[] args) { final Person p = new Person("张三", 23); p.setName("李四"); p.setAge(24); System.out.println(p); } } class Person { private String name; private int age; public Person() { super(); } public Person(String name, int age) { super(); this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "我的姓名是:" + name + ",我的年龄是:" + age ; } }

    分析下面的程序,输出的结果是? public class Test { public static void main(String[] args) { final Person p = new Person("张三", 23); p.setName("李四"); p.setAge(24); System.out.println(p); } } class Person { private String name; private int age; public Person() { super(); } public Person(String name, int age) { super(); this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "我的姓名是:" + name + ",我的年龄是:" + age ; } }

  • 2022-06-08 问题

    以下程序的运行结果是_____function Person(age) {this.age = age;this.sayHi = function(){console.log(ps.name,":",ps.age);}}Person.prototype.name = "tom";var ps = new Person(3);ps.sayHi();(答案字母必须全部小写,标点符号用半角,不能有空格)

    以下程序的运行结果是_____function Person(age) {this.age = age;this.sayHi = function(){console.log(ps.name,":",ps.age);}}Person.prototype.name = "tom";var ps = new Person(3);ps.sayHi();(答案字母必须全部小写,标点符号用半角,不能有空格)

  • 2021-04-14 问题

    【填空题】public class ThisTest{ private String name; private int age; public ThisTest() { System.out.println("产生一个新的Person对象。"); } public ThisTest (String name, int age) { this(); this.name = name; this.age = age; } public String getInf() { return "姓名:" + name + ",年龄:" + age; } public static void main(String[] args) { ThisTest per = new ThisTest("张三", 20); System.out.println(per.getInf()); } } 运行结果为:____

    【填空题】public class ThisTest{ private String name; private int age; public ThisTest() { System.out.println("产生一个新的Person对象。"); } public ThisTest (String name, int age) { this(); this.name = name; this.age = age; } public String getInf() { return "姓名:" + name + ",年龄:" + age; } public static void main(String[] args) { ThisTest per = new ThisTest("张三", 20); System.out.println(per.getInf()); } } 运行结果为:____

  • 2022-06-01 问题

    有如下类的定义,创建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");

    有如下类的定义,创建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");

  • 2022-06-11 问题

    下面程序运行的结果是 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); } }

    下面程序运行的结果是 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); } }

  • 2022-06-01 问题

    有如下类的定义,创建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 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");

  • 2022-06-08 问题

    class Person { String name; int age; [br][/br] public Person(String name, int age) { super(); this.name = name; this.age = age; } @Override public boolean equals(Object obj) { Person person=null; if(obj instanceof Person) person=(Person)obj; if(name.equals(person.name)&&age==person.age) return true; return false; } } class Test{ public static void main(String[] args) { Person person1 = new Person("张三", 12); Person person2 = new Person("张三", 12); System.out.println(person1.equals(person2));//运行结果是? } } 程序运行结果是什么? A: true B: false

    class Person { String name; int age; [br][/br] public Person(String name, int age) { super(); this.name = name; this.age = age; } @Override public boolean equals(Object obj) { Person person=null; if(obj instanceof Person) person=(Person)obj; if(name.equals(person.name)&&age==person.age) return true; return false; } } class Test{ public static void main(String[] args) { Person person1 = new Person("张三", 12); Person person2 = new Person("张三", 12); System.out.println(person1.equals(person2));//运行结果是? } } 程序运行结果是什么? A: true B: false

  • 2022-05-29 问题

    下面哪一个表达式能正确表示逻辑关系:"age≥18 或age≤60"? A: age>=18 || age B: age>=18 or age C: age>=18 | age D: age>=18 && age

    下面哪一个表达式能正确表示逻辑关系:"age≥18 或age≤60"? A: age>=18 || age B: age>=18 or age C: age>=18 | age D: age>=18 && age

  • 2022-05-29 问题

    表达式“AGE BETWEEN 18 AND 24”等价于 A: AGE>18 AND AGE<24 B: AGE>=18 AND AGE<24 C: AGE>18 AND AGE<=24 D: AGE>=18 AND AGE<=24

    表达式“AGE BETWEEN 18 AND 24”等价于 A: AGE>18 AND AGE<24 B: AGE>=18 AND AGE<24 C: AGE>18 AND AGE<=24 D: AGE>=18 AND AGE<=24

  • 1 2 3 4 5 6 7 8 9 10