001-2 servlet的生命周期
001-3 statement与preparestatement的区别
001-4 class.forName("...")与new Class()的区别
001-5 JSP的生命周期
001-1
过关答案:
线程状态有:Runnable Block Dead
线程通过start来启动进入Runnable
Runnable---->Block sleep wait I/O
Block--->Runnable notify notifyAll interrupt
Deal 线程运行结束
相关参考:
http://blog.youkuaiyun.com/bolida/archive/2007/07/24/1704972.aspx
http://caterpillar.onlyfun.net/GossipCN/JavaGossip-V2/ThreadLife.htm
001-2
过关答案:
加载类----实例化----初始化----service----destroy
相关参考:
http://www.linuxpk.com/45432.html
001-3
过关答案:
PreparedStatement继承于Statement
Statement用于执行简单的sql语句,PreparedStatement可以设置占位符,动态的传参
PreparedStatement 执行效率高于Statement如同构的sql语句发送到数据库时这时数据只编译一次。
Statement不安全
相关参考:
http://mrchenw.spaces.live.com/blog/cns!43B11FE45613988F!806.entry?&_c02_owner=1
http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=121&threadID=10397
001-4
过关答案
使用newInstance主要考虑到软件的可伸缩、可扩展和可重用等软件设计思想
New使用时可能类没有加载,而newInstance使用就必须保证:1、这个 类已经加载;2、这个类已经连接了。而完成上面两个步骤的正是Class的静态方法forName()所完成的,这个静态方法调用了启动类加载器,即加载 java API的那个加载器。
newInstance是一种降耦的手段,也就是可以通过字符串,或者读取xml文件来动态加载一个类然后获得该类的对象
newInstance: 弱类型。低效率。只能调用无参构造。
new: 强类型。相对高效。能调用任何public构造。
相关参考:
http://www.blogjava.net/hh-lux/archive/2007/08/20/138144.html
001-5
过关答案:jsp----.java----.class----加载类----实例化----jspInit----_jspService ----jspDestory
相关参考:http://caterpillar.onlyfun.net/GossipCN/JSPServlet/JSPLifeTime.htm
http://stor.51cto.com/art/200705/47900.htm