system.out.println(“ok”);} public baseclass(string s){ str=s;}}
public class example{ public void method(){
subclass s=new subclass(“hello”); baseclass b=new baseclass(“world”); } }
which line would be cause the error? a.9 b.10 c.11 d.12 11:
string s=”example string”;which operation is not legal? string s=”example string”;which operation is not legal? a.int i=s.length(); b.s[3]=”x”;
c.string short_s=s.trim(); d.string t=”root”+s;
12:软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开发顺序?
a.计划阶段、开发阶段、运行阶段 b.设计阶段、开发阶段、编码阶段 c.设计阶段、编码阶段、维护阶段 d.计划阶段、编码阶段、测试阶段
13:which statements about java code security are not true?
a.the bytecode verifier loads all classes needed for the execution of a program. b.executing code is performed by the runtime interpreter.
c.at runtime the bytecodes are loaded, checked and run in an interpreter. d.the class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.
14: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 15:
give the following method: public void method( ){ string a,b;
a=new string(“hello world”); b=new string(“game over”); system.out.println(a+b+”ok”); a=null; a=b;
system.out.println(a); }
in the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection. give the following method: public void method( ){ string a,b;
a=new string(“hello world”); b=new string(“game over”); system.out.println(a+b+”ok”); a=null; a=b;
system.out.println(a); }
in the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection. a.before line 5 b.before line 6
c.before line 7 d.before line 9 简答题
16:请阐述一下你对java多线程中“锁”的概念的理解。 17:列出jsp中包含外部文件的方式,两者有何区别。
18:请谈谈对一个系统设计的总体思路。针对这个思路,你觉得应该具备哪些方面的知识?
19:struts2中的拦截器,你用过那些自带的拦截器,自己写过的吗? 20:怎样在复杂的各种形式的网页中提取mp3下载的结构化数据? 21:编写一个在二叉排序树中查找大小为第k的元素的算法。
22:java多线程编程。 用java写一个多线程程序,如写四个线程,二个加1,二个对一个变量减一,输出。
23:不允许使用系统时间,写出一个随机数生成函数。
24:hibernate中的id(主键)生成器有那些?或者你常用的是那些?
25:error和exception有什么区别?
---------------=============================================================
第一,谈谈final, finally, finalize的区别。
final 如果一个类被声明为final,意味着它不能再派生出新的子类,因此一个类不能既被声明为 abstract的,又被声明为final的。将变量或方法声明为final,可以保证它们在使用中不被改变。被声明为final的变量必须在声明时给定初值,而在以后的引用中只能读取,不可修改。被声明为final的方法也同样只能使用,不能重载。
finally 用来清除异常。如果抛出一个异常,那么相匹配的 catch 子句就会执行,然后控制就会进入 finally 块(如果有的话)。
finalize() 在垃圾收集器将对象从内存中清除出去之前做必要的清理工作。它是在 Object 类中定义的,因此所有的类都继承了它。
第二,Anonymous Inner Class (匿名内部类) 是否可以继承其它类,是否可以实现接口?
匿名的内部类是没有名字的内部类。不能继承其它类,但可作为一个接口,由另一个内部类实现。
第三,Static Nested Class 和 Inner Class的不同。
Nested Class (一般是C++的说法),Inner Class (一般是JAVA的说法)。Java内部类与C++嵌套类最大的不同就在于是否有指向外部的引用上。 注:静态内部类(Inner Class)意味着: 1 创建一个static内部类的对象
2 不能从一个static内部类的一个对象访问一个外部类对象
第四,&和&&的区别。
&是位运算符。&&是布尔逻辑运算符。
第五,HashMap和Hashtable的区别。
都属于Map接口的类,实现了将惟一键映射到特定的值上。 HashMap 类 允许一个 null 键和多个 null 值。
Hashtable 类 不允许 null 键和 null 值。它也比 HashMap 慢,因为它是同步的。
第六,Collection 和 Collections的区别。
Collections是个java.util下的类,它包含有各种有关集合操作的静态方法。 Collection是个java.util下的接口,它是各种集合结构的父接口。
第七,什么时候用assert。
断言是一个包含布尔表达式的语句,在执行这个语句时假定该表达式为 true。如果表达式计算为 false,那么系统会报告一个 AssertionError。 示例:
assert(a > 0); // throws an AssertionError if a <= 0 断言可以有两种形式: assert Expression1 ;
assert Expression1 : Expression2 ;