- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
J2SE基础试题
J2SE基础试题
班级: 姓名: 时间: 选择题(没有注明多选,则为单选)
封装
抽象
继承
多态
允许一个类的成员访问同一包中其它类的成员的最受限的修饰符为?
public
protected
abstract
private
欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的 ?ArrayList myList=new Object(); List myList=new ArrayList();
List myList=new List();
ArrayList myList=new List();
如果int[] A = new int[5]; 则A[1]的值为
null
0
1
编译出错
5. 所给代码如下:
1) class Example{
2) String str;
3) public Example(){
4) str= example;
5) }
6) public Example(String s){
7) str=s;
8) }
9) }
10) class Demo extends Example{
11) }
12) public class Test{
13) public void f () {
14) Example ex = new Example(Good);
15) Demo d = new Demo(Good);
16) }
17) }
该代码会在那一行出错?
A. line 3
B. line 6
C. line 10
D. line 14
E. line 15
6. 下面那种描述是正确的?
A. 在Java中不允许多重继承,这样可以使程序更加可靠
B. 子类继承父类的所有方法 (包括构造方法)
C. 一个类可以实现很多接口.
D. 当一个类实现一个接口,那么他就必须定义该接口中的所有方法。
What will be the result of executing the following code? ( )
public static void main(String args[]){
char digit=’a’;
for(int i=0; i10; i++){
switch(digit){
case ’x’:{
int j=0;
System.out.println(j);
}
Default:{
int j=100;
System.out.println(j);
}
}
}
int i=j;
System.out.println(i);
}
A. 100 will be printed 11 times.
B. 100 will be printed 10 times and then there will be a runtime exception.
C. The code will not compile because the variable i cannot be declared twice within the main() method.
D. The code will not compile because j cannot be resolved to a variable.
E. None of these
下列的方法能够正常运行
public void example(){ try{ unsafe(); System.out.println(Test1); } catch(SafeException e) {System.out.println(Test 2);} finally{System.out.println(Test 3);} System.out.println(Test 4); }
下列哪项不会输出
Test1
Test2
Test3
Test4
指出下列哪个方法与方法public void add(int a){}合理的重载方法。
public int add(int a)
public void add(long a)
public void add(int a,int b)
public void add(float a)
public static void main(Stirng[] args){
System.out.println(‘c’+1+”a”);
};
程序输出结果为
c1a
197
c98
100a
看程序写结果题(每题4分,共20分)
程序如下:
class
文档评论(0)