2个引用变量,1个对象
1个引用变量,1个对象
2个引用变量,2个对象
1个引用变量,2个对象
多选题对于如下代码,描述正确的是哪项? () class Student{ public static void main(String[] args){ Student student = new Student(); } }AStudent student 声明了一个类Bnew Student()创建了Student 对象的一个实例CStudent student 声明了对象Student 的一个引用Dclass Student 声明了一个类
点击查看答案
单选题下述代码执行后,有几个引用变量和几个对象?() 对象声明Student stu(对象)= new Student(“Mike”); 对象定义(开辟空间) Student stua;(声明变量) Stua = stu;A2个引用变量,1个对象B1个引用变量,1个对象C2个引用变量,2个对象D1个引用变量,2个对象
单选题类Student代码如下:D class Student{ String name; int age; Student(String nm){ (构造方法) name = nm; } } 执行语句Student stu = new Student()后,字段age的值是哪项?()A0BnullCfalseD编译错误
多选题对于如下代码,描述正确的是哪项?() class Student{ public static void main(String[] args){ Student student=new Student(); } }Anew Student()创建了Student对象的一个实例BStudent student声明了对象Student的一个引用Cclass Student声明了一个类Dnew Student()创建了一个类EStudent student 声明了一个类
单选题下述代码执行后,可以被垃圾收集器收集的对象是哪一个() Student stua; stua = new Student(“Mike”); Student stub; stub = stua; stua = new Student(“Jack”);A Student(“Mike”)B stuaC stubD 以上都不是
单选题下述代码执行后,有几个引用变量和几个对象?() Student stu = new Student(“Mike”); Student stua; Stua = stu;A2个引用变量,1个对象B1个引用变量,1个对象C2个引用变量,2个对象D1个引用变量,2个对象
单选题类Student的声明如下: package com.school class Student{ String name; int age; Student(String name,int age){ //code } void study(String subject){ / /code } } 正确调用方法study(String subject)的是哪项?()A Student stu = new Student(“Tom”,23); stu.study(“数学”);B Student.study(“数学”);C Student stu = new Student(“Tom”,23); stu.study();D Student stu = new Student(“Tom”,23); String result=stu.study(“数学”);