考试时间: 17 周周二 5,6 节 100 分钟
地点:五教 0110,0107
共 130 人, 记录单前 60 名同学在 0110, 后 60 名同学在 0107
一、选择题
1. Java application 中得主类需包含 main 方法,main 方法得返回类型就是什么?( )
A、int B、float C、double D、void
2、、函数重载就是指
A、两个或两个以上得函数取相同得函数名,但形参得个数或类型不同
B、两个以上得函数取相同得名字与具有相同得参数个数,但形参得类型可以不同
C、两个以上得函数名字不同,但形参得个数或类型相同
D、两个以上得函数取相同得函数名,并且函数得返回类型相同�
3、、指出下列程序运行得结果
public class Example{
String str=new String(″good″);
char[]ch={′a′,′b′,′c′};
public static void main(String args[]){
Example ex=new Example;
ex、change(ex、str,ex、ch);
System、out、print(ex、str+″and″);
System、out、print(ex、ch);
}
public void change(String str,char ch[]){
str=″test ok″;
ch[0]=′g′;
}
}
A、good and abc B、good and gbc
C、test ok and abc D、test ok and gbc
4、、指出下列程序运行得结果
public class Example{
person p=new person;
char[] ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example;
ex、change(ex、p,ex、ch);
System、out、print(ex、p、age+"and");
System、out、print(ex、ch);
}
public void change(person p,char ch[]){
p、age=30;
ch[0]='g';
}
}
class person{