Java经典模拟题(onlyfortrainning)(2)

文章作者 100test 发表时间 2007:03:14 17:02:26
来源 100Test.Com百考试题网


1 1. which modifier should be applied to a method for the lock of object this to be obtained prior to execution any of the method body?
a. synchronizedb. abstractc. finald. statice. public

12. the following code is entire contents of a file called example.java,causes precisely one error during compilation:
1)class subclass extends baseclass{
2) }
3)class baseclass(){
4) string str.
5) public baseclass(){
6) system.out.println(“ok”).}
7) public baseclass(string s){
str=s.}
9)}
10)public class example{
11) public void method(){
12) subclass s=new subclass(“hello”).
13) baseclass b=new baseclass(“world”).
14) }
15) }

which line would be cause the error?
a. 9b. 10c. 11d.12
13. which statement is correctly declare a variable a which is suitable for refering to an array of 50 string empty object?
a. string [] ab. string a[]c. char a[][]d. string a[50]f. object a[50]

14. give the following java source fragment:
//point x
public class interesting{
//do something
}
which statement is correctly java syntax at point x?
a. import java.awt.*.b.package mypackage.c. static int pi=3.14
d. public class myclass{//do other thing…}e. class myclass{//do something…}

15. give this class outline:
class example{
private int x.
//rest of class body…
}
assuming that x invoked by the code java example, which statement can made x be directly accessible in main() method of example.java?
a. change private int x to public int xb. change private int x to static int x
c. change private int x to protected int xd. change private int x to final int x

16. a class design requires that a member variable should be accessible only by same package, which modifier word should be used?
a. protectedb. publicc. no modifierd. private

相关文章


多线程编程实战篇秘籍(二)
JAVA题库:格林模拟试题一(上)(2)
JAVA题库:格林模拟试题一(上)(1)
编写多线程Java应用程序常见问题
Java经典模拟题(onlyfortrainning)(2)
Java经典模拟题(onlyfortrainning)(1)
理解JavaHelp结构的好处
java入门Java中的日期处理
Java认证模考试题(十一)
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛