电话:0731-83595998
导航

格林模拟试题三参考答案(3)

来源: 2017-12-19 10:54

 swer to question 27)

2) output of "hello crowle"

this code is an example of a short circuited operator. because the first operand of the || (or) operator returns true java sees no reason to evaluate the second. whatever the value of the second the overall result will always be true. thus the method called place is never called.

answer to question 28)

4) none of the above;

you may access methods of a direct parent class through the use of super but classes further up the hierarchy are not visible

answer to question 29)

2) a method with the same name completly replaces the functionality of a method earlier in the hierarchy

option 3 is more like a description of overloading. i like to remind myself of the difference between overloading and overriding in that an overriden method is like something overriden in the road, it is squashed, flat no longer used and replaced by something else. an overloaded method has been given extra work to do (it is loaded up with work), but it is still being used in its original format. this is just my little mind trick and doesn't match to anything that java is doing.

answer to question 30)

2) the / operator is used to divide one value by another

the % is the modulo operator and returns the remainder after a division. thus 10 % 3=1

|||

answer to question 31)

1) the default layout manager for an applet is flowlayout

the default layout manager fror an application is borderlayout. an applet will use the default of flowlayout if one is not specifically applied

answer to question 32)

3) only one instance of a static variable will exist for any amount of class instances

option 1) is more a description of a final variable. option 2 is designed to fool visual basic programmers like me as this is how you can use the keyword static in vb. the modifier static can be applied to a class (only an innner class) , method or variable.

answer to question 33)

1) java uses a system called utf for i/o to support international character sets
4) file i/o activities requires use of exception handling

internally java uses unicode which are 16 bit characters. for i/o java uses utf which may be more thatn 16 bits per chamore thatn 16 bits per character.

|||

answer to question 34)

1) compile time error

it wil produce an error like "abstract and native method can't have a body. this is typical of the more misleading question where you might think it is asking you about the circumstances under which the finally clause runs, but actually it is about something else.

answer to question 35)

2) compilation and run with the output "running"

this is perfectly legitimate if useless sample of creating an instnace of a thread and causing its run method to execute via a call to the start method. the thread class is part of the core java.lang package and does not need any explicit import statement. the reference to a thread target is an attempt to mislead with a reference to the method of using the runnable interface instead of simply inheriting from the thread super class.

answer to question 36)

1) randomaccessfile raf=new randomaccessfile("myfile.txt","rw");

the randomaccessfile is an anomaly in the java i/o architecture. it descends directly from object and is not part of the streams architecture

answer to question 37)

2) public int amethod(int i, int j) {return 99;}
4) private void anothermethod(){}

option 1 will not compile on two counts. one is the obvious one that it claims to return an integer. the other is that it is effectivly an attempt to redefine a method within the same class. the change of name of the parameter from i to z has no effect and a method cannot be overriden within the same class.

answer to question 38)

1) code must be written to cause a frame to close on selecting the system close menu
4) the gridbaglayout manager makes extensive use of the the gridbagconstraints class.

you can change the layout manager for a frame or any other container whenever you like

编辑推荐:

下载Word文档

温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)

网络课程 新人注册送三重礼

已有 22658 名学员学习以下课程通过考试

网友评论(共0条评论)

请自觉遵守互联网相关政策法规,评论内容只代表网友观点!

最新评论

点击加载更多评论>>

精品课程

更多
10781人学习

免费试听更多

相关推荐
图书更多+
  • 电网书籍
  • 财会书籍
  • 其它工学书籍
拼团课程更多+
  • 电气拼团课程
  • 财会拼团课程
  • 其它工学拼团
热门排行

长理培训客户端 资讯,试题,视频一手掌握

去 App Store 免费下载 iOS 客户端