b. 320
c. 032
d. (octal)2
e. 12
14.当你运行tester2类时,将得到什么标准输出结果 (单选)
class Tester2{
int var
Tester(double var){
This.var =(int)var
}
Tester(int var){
This(“hello”)
}
Tester(String S ){
this ();
System.out.println(s);
}
Tester(){
System.out.println(“good-bye”);
}
public static void main(String[] args){
Tester t = new Tester(5);
}
}
a. nothing
b. “hello”
c. 5
d. “hello”following by “good -bye”
e. “good-bye”following by “hello”
15. 根据提供如下代码,如果方法 try This() 发生一个NumberFormatException,将得到什么标准结果?(单选)
try{
tryThis();
return;}catch(IOException x1){
System.out.println(“exception1”);
Return;} catch(Exception x2){
System.out.println(“exception2”);
Return;
}finally{
System.out.println(“finally”);
}
16.给出如下代码,如果此snippet 在标准输出中显示为90,则method()调用了何种数学方法?(单选)
double a=90.7;
double b=method(a);
System.out.println(b);
17.如果”Ran.test”文档并不存在,而你试图编译并运行一下代码时,将会发生什么情况?(单选)
import java.io.*;
class Ram{
public static void main()(String[] args) throws IOExcetion {
RandomAccessFile.out = new RandomAccessFile (“Ran.test”,”rw”);
Out.wntebytes(“Ninotchka”);
}
}
18.当你创建一个新的线程时,如果提供一个目标对象,TargetObject是什么类型的实例才能作为合法参数传入;
Thread t=new Thread(targetObject);
19.给出如下的代码片断,哪一个表达式为合法的java表达式,且返回值为真?(单选);
Boolean b1=new Boolean(true);
Boolean b2=new Boolean(true);
20.下列哪一个布局管理器以从左至右,然后从上到下,以每一行为中心移动的方式排列组件?(单选);
21.下列哪一个关于垃圾收集的描述是正确的?(多选)
22.Given this interface definition;根据该界面定义,下列哪一个类能实现该接口并不是抽象类?(多选)
interface A{
int method1(lnt I);
int method2(int j);
}
23、Examine the following switch block 根据如下的转换流,下列哪个命题是正确的?(多选)
char mychar=’c’;
switch(mychar){
default;
case’a’:System.out.println(“a”);break;
case’b’:System.out.println(“b”);break;
}
a、 This switch block is illegal,,because onlyintegers can be used in the switch statement.
b、 This switch block is fine.
c、 This switch block is illegal,because the default statement must come last.
d、 When this code runs,nothing is written to the standard output.
e、 When this code runs,the letter”a”is written to the standard output.
24、如果你编译,运行以下类,将会出现什么情况?(单选)
class Test{
static int myArg=1;
pubhc static vold main(String[]args){
int myArg;
System.out.printin(myArg);
}
}
a、 This code compiles and displays0 inthe standard output when run.
b、 This code compiles and displays1 inthe standard output when run.
c、 This code does not compile because you cannot define a local variable named the same as a static variable.
d、 This code does not compile because the local variable is used before it is initialized.
25、如果你用名为c的变量为引用组件调用addContainerListener()函数,请估计下列哪个表达式将为这个问题提出正确或错误的回答?(单选)
a、 C==Container
b、 c.equals(Class. Container)
c、 c instanceof Container
d、 c instanceof Component
e、 c implements Container
26、当下列程序运行“java Mystery Mighty Mouse”命令时将得到什么结果?(单选)
java Mystery Mighty Mouse
Class Mystery{
Bublic static void main(String[] args)
{
Changer c=new Changer();
c.method(args);
System.out.printin(args[0]+””+args[1]);
}
static class Changer
{
void method(String [] s)
{
String temp=s[0];
s[0] = s[1];
s[1] = temp;
}
}
27根据提供的如下代码,请问在//A处应该补充什么代码该程序可以标准输出单词‘running’ (单选)
Class Run Test implements Runnable
{
public static void main(String [] args)
{
RunTest rt = new RunTest();
Thread t = new Thread(rt);
//A
}
public void run()
{
System.out.println(“running”);
}
void go()
{
start(1);
}
void start (int i)
{
}
}
28.分析下面的一行代码,选择一个正确的回答(单选)
if(5&7 > 0&& 5|2)System.out.println(“true”);
29.请选出有关在Component 类中定义的pa