浙江大学远程教育 电子商务(本科)
JAVA模拟试题
多项选择题(在每小题的五个备选答案中选出正确答案,并将正确答案的序号填入题干后面的括号内,错选多选,漏选均不得分。)
1、给出如下代码:
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
2、下面哪几个函数是public void example(){...}的重载函数?
A、 public void example( int m){...}
B、public int example(){...}
C、public void example2(){...}
D、 public int example ( int m, float f){...}
答: A,D
3、给出下面的代码段:
public class Base{
int w, x, y ,z;
public Base(int a,int b)
{
x=a; y=b;
}
public Base(int a, int b, int