题目内容

补全代码,完成Student类的构造方法。public class Student{ int studnentNo; String studentName; public ______ ( ){ }}

查看答案
更多问题

构造器,又称为构造方法,英文名为______

class Computer{ String brand;}class Student{ String name; Computer spc;}public class Test{ public static void main(String[] args){ Computer c = new Computer(); c.brand = "联想"; Student s = new Student(); s.spc = c; System.out.println(s.spc.brand);//这句话的输出是______ c.brand = "HuaWei"; System.out.println(c.brand);//这句话的输出是______ System.out.println(s.spc.brand);//这句话的输出是______ }}

public class Dog{ String name; int age; boolean isLive; public static void main(String[] args){ Dog dog1 = new Dog(); Dog dog2 = new Dog(); } }在上述代码中,有______ 个基本数据类型的属性,有______ 个引用数据类型的属性

public class Dog{ String name; public static void main(String[] args){ Dog dog = new Dog(); } }上面这段代码中,______ 是成员变量,______ 是局部变量。

答案查题题库