|
18. A class design requires that a member variable should be accessible only by same package, which modifer word should be used? A. protected B. public C. no modifer D. private
19.Which declares for native method in a java class corrected? A. public native void method(){} B. public native void method(); C. public native method(); D. public void method(){native;} E. public void native method();
20. Which modifer should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object?
16-20答安: 16。B 静态方法除了自己的参数外只能直接访问静态成员。访问非静态成员,必须先实例化本类的一个实例,再用实例名点取。 17。A、B、D polygon的顶点信息存放在Vector类型的对象内部,color定义为Color,length和width定义为int。 注意,这是考试中常见的题型。 18。C 此题考点是高级访问控制。请考生查阅高级访问控制说明表格。 19。B native关键字指明是对本地方法的调用,在JAVA中是只能访问但不能写的方法,它的位置在访问权限修饰语的后面及返回值的前面。 20。final 定义常量的方法是在变量定义前加final关键字。
21. Which is the main() method return of a application? A. String B. byte C. char D. void
22. Which is corrected argument of main() method of application? A. String args B. String ar[] C. Char args[][] D. StringBuffer arg[]
23. “The Employee object is a person, An Employee has appointment store in a vector, a hire date and a number of dependent” short answer: use shortest statement declare a class of Employee.
24. Give the following class defination inseparate source files: public class Example{ public Example(){//do something} protected Example(int i){//do something} protected void method(){//do something} } public class Hello extends Example{//member met上一页 [1] [2] [3] [4] [5] [6] [7] 下一页 |
|
|
|
|
|
|
|