东北大学2019春学期《JAVA语言程序设计Ⅰ》在线作业1-0001
	试卷总分:100    得分:100
	一、 单选题 (共 20 道试题,共 60 分)
	1.下列代码的执行结果是 public class Test { public int aMethod() { static int i=0; i++; System.out.println(i); } public static void main(String args[]) { Test test = new Test();
	A.编译错误
	B.0
	C.1
	D.运行成功,但不输出
	答案来源:www.youxue100f.com正确答案:A
	
	2.下面程序的输出结果是什么? public static void main(String args[]) { int a=10; int b=20; if(a=b) System.out.println("Not Equal"); else System.out.println("Equal"); }
	A.Equal
	B.Not Equal
	C.编译错误
	D.运行时将抛出异常
	正确答案:C
	
	3.Person, Student 和Teacher 都是类名。这些类有以下继承关系。 Person | -------------------- | | Student Teacher 并且在Java源代码中有如下表达式: Person p = new Student(); 如下哪个语句是正确的?
	A.这条语句是合法的
	B.这条语句是不合法的
	C.编译时出错
	D.编译正确但运行时出错
	正确答案:A
	
	4.已知如下的命令执行 java MyTest a b c 请问哪个语句是正确的?
	A.args[0] = "MyTest a b c"
	B.args[0] = "MyTest"
	C.args[0] = "a"
	D.args[1]= 'b'
	正确答案:C
	
	5.下列类头定义中,错误的是( )。
	A.class x { .... }
	B.public x extends y { .... }
	C.public class x extends y { .... }
	D.class x extends y implements y1 { .... }
	正确答案:B
	
	6.下面程序的输出结果是什么? class C1{ static int j=0; public void method(int a){ j++; } } class Test extends C1{ public int method(){ return j++; } public void result(){ method(j); System.out.println(j+method()); } public static void main(String args[]){ new Te
	A.0
	B.1
	C.2
	D.3
	正确答案:C
	
	7.下列哪个选项的java源文件代码片段是不正确的?
	A.package testpackage; public class Test{ }
	B.import java.io.*; package testpackage; public class Test{ }
	C.import java.io.*; class Person{ } public class Test{ }
	D.import java.io.*; import java.awt.*; public class Test{ }
	正确答案:B
	
	8.下面程序的输出结果是什么? String s= "ABCD"; s.concat("E"); s.replace('C','F'); System.out.println(s);
	A.编译错误,字符串是不可改变的
	B.ABFDE
	C.ABCDE
	D.ABCD
	正确答案:D
	
	9.给出如下代码: class Test{   private int m;   public static void fun() {     // some code...   } } 如何使成员变量m被函数fun()直接访问?
	A.将private int m 改为protected int m
	B.将private int m 改为 public int m
	C.将private int m 改为 static int m
	D.将private int m 改为 int m
	正确答案:C
	
	10.设有下面的一个类定义: class AA { static void Show( ){ System.out.println("我喜欢Java!"); } } class BB { void Show( ){ System.out.println("我喜欢C++!"); } } 若已经使用AA类创建对象a和BB类创建对象b,则下面哪一个方法调用是正确的:( )
	A.a.Show( ) b.Show( )
	B.AA.Show( ) BB.Show( )
	C.AA.Show( ) b.Show( )
	D.a.Show( ) BB.Show( )
	正确答案:C
