多项选择题
对于如下代码,描述正确的是哪项? ()
class Student{
public static void main(String[] args){
Student student = new Student(); } }
A.Student student 声明了一个类
B.new Student()创建了Student 对象的一个实例
C.Student student 声明了对象Student 的一个引用
D.class Student 声明了一个类
点击查看答案&解析
相关考题
-
多项选择题
现有2 个文件: 1. package x; 2. public class X { 3. public static void doX() { System.out.print("doX "); } 4. } 和: 1. class Find { 2. public static void main(String [] args) { 3. //insert code here 4. } 5. } 哪两行分别插入到类Find 的第3 行将编译并产生输出“doX”? ()
A.doX();
B.X.doX();
C.x.X.doX();
D.x.X myX = new x.X(); myX.doX(); -
多项选择题
程序员已经创建了一个类,该类的实例可以用做Hashtable的键(key)。哪两项是对的?()
A.该类有一个返回类型为 int 的 equals 方法。
B.该类有一个返回类型为 boolean 的 equals 方法。
C.该类有一个接收一个参数的 equals 方法。
D.该类有一个接收两个参数的 equals 方法。 -
多项选择题
class Flow { public static void main(String [] args) { try { System.out.print("before "); doRiskyThing(); System.out.print("after "); } catch (Exception fe) { System.out.print("catch "); } System.out.println("done "); } public static void doRiskyThing() throws Exception { // this code returns unless it throws an Exception } } 可能会产生下面哪两项结果?()
A.before
B.before catch
C.before after done
D.before catch done
