m.out.println(“s=”+s);
}
}
程序运行的结果是?
A、 s=s B、s=null
C、 编译错误 D、null
34.public class Foo{public static void main(String args[]){
try{return;}
finally{ System.out.println(“Finally”);}
}
程序运行的结果是?
A、什么也没有
B、Finally
C、编译错误
35.下面那个变量声明不正确的?
A、IloveJava
B、$20
C、piggy@msl
D、Hello_world
36.下面关于JAVA的优点说法错误的是?
A、JAVA是纯面向对象的语句,还有众多的API支持,所以JAVA开发各种各样的应用
程序变的非常容易且易于维护。
B、JAVA使用的是Unicode作为标准字符,这使得JAVA程序在不同的语言平台上都能
被编译和运行。
C、JAVA引进来的EXCEPTION处理机制,使得JAVA程序更安全、更稳定、更随机应变
D、垃圾回收机制是JAVA的内在特性,垃圾回收机制的调度是有程序员负责的
37.下面关于JVM说法不准确的是?
A、 JVM目前已有针对不同的平台开发了多个相应的版本。
B、所以的JAVA程序编译成字节码后都需要被调度到相应版本的JVM中才能执行。
C、各个版本的JVM对内存的管理都是通过GC机制实现的
D、JVM机制的引入才使我们的程序很容易的动态内存管理及多线程、JavaBean等服务。
38.下面关于JDK工具的说法不正确的?(复选题)
A、我们可以通过JAVAC工具实现对JAVA程序的编译并能通过-d参数指定字节码文件
的位置。
B、-classpath无论对java及javac工具都有引进其它类的作用。
C、javadoc工具可以把我们程序用所有注释部分自动生成html文档.
D、appletview工具可以用来运行我们的applet小程序。
39.下面关于int在java程序中长度的说法精确的是?
A、1 bytes
B、2 bytes
C、4 bytes
D、8 bytes
40.下面代码中那一个不能够创建一个数组
A 、float []f[] = new float[6][6];
B 、float f[][] = new float[][6];
C、float [][]f = new float[6][6];
D、float [][]f = new float[6][];
41.给出如下声明?
String s1=new String(“Hello”);
String s2=new String(“there”);
String s3=new String();
下列选现中( )是合法的
A、s3 = s1 + s2 B、s3 = s1 – s2 C、s3 = s1 & s2 D、s3 = s1 && s2
42.给出下面代码段:
boolean m = true;
if(m = false)
System.out.println(“False”);
else
System.out.println(“True”);
运行的结果是 ( )
A 、False B、True
C、 None D、 An error will occur when running
43.下面的程序编译运行的结果是:
public class Something {
public static void main(String[] args) {
Other o = new Other();
new Something().addOne(o);
}
public void addOne(final Other o) {
o.i++;
}
}
class Other {
public int i;
}
A、编译时出错
B、运行时出错
C、正确运行
44.下面代码如何使成员变量m 被函数fun()直接访问
class Test{
private int m;
public static void fun() {
// some code…
}
}
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
45.面哪几个函数是public void example(){…}的重载函数?(复选题)
public void example( int m){…}
public int example(){…}
public void example2(){…}
public int example ( int m, float f){…}
46.下面的代码段中,执行之后i 和j 的值是什么
int i = 1;
int j;
j = i++;
A、1, 1
B、1, 2
C、2, 1
D、2, 2
47.已知如下的命令执行 java MyTest a b c请问哪个语句是正确的?
A、args[0] = “MyTest a b c”
B、args[0] = “MyTest”
C、args[0] = “a”
D、args[1]= ‘b’
48.如下代码正确的结果是:
public class Test
{
long a[] = new long[10];
public static void main ( String arg[] ) {
System.out.println ( a[6] );
}
}
没有输出
输出0
编译时出错
运行时出错
49.下面代码输出的结果是:(复选题)
public class Test
{
public static void main(String arg[])
{
int i = 5;
do {
System.out.println(i);
} while (–i>5)
System.out.println(“finished”);
}
}
4
5
6
finished
50.在如下源代码文件Test.java中, 哪个是正确的类定义?(复选题)
public class test {
public int x = 0;
public test(int x)
{
this.x = x;
}
}
public class Test{
public int x=0;
public Test(int x) {
this.x = x;
}
}
public class Test extends T1, T2 {
public int x = 0;
public Test (int x) {
this.x = x;
}
}
public class Test extends T1{
public int x=0;
public Test(int x){
this.x = x;
}
}
51.class J_Test{
public static void main(String args[])
{
int i= 99;
mb_operate(i);
System.out.print(i+100);
} // End of method: main
static void mb_operate(int i)
{
i+=100;
} // End of method: mb_ operate
} // End of class: J_Test
上面程序的输出是什么 ( )
A、 99 B、 199 C、 299 D、 99100
下面代码运行的结果是:
String s = new String(“Bicycle”);
int iBegin = 1;
char iEnd = 3;
System.out.println(s.substring(iBegin, iEnd));
A、Bic
B、ic
C、icy
D、error:no method matching substring(int,char)
53.class J_StringBuffer{
public static void main(String args[]){
StringBuffer