18. 描述 J2EE 框架的多层结构,并简要说明各层的作用。
19.简要描述如何结合 struts、hibernate、spring 开发 Web 应用? 20.说明反转控制(IOC)和面向方向编程(AOP)在 spring 中的应用
21.请看如下片段:
inverse=“false” cascade=“all-delete-orphan”>
解释 lazy、inverse、cascade 以及 all-delete-orphan 属性的含义;并给出示例代码,说明在如下 组合情况下,对于 save、update、delete 一对多关系中的一方对象操作时的区别:
inverse true false true false true false
cascade all-delete-orphan all-delete-orphan all all none none 22. 简述基于 Struts 框架 Web 应用的工作流程
23. 在项目中用过 Spring 的哪些方面?及用过哪些 Ajax 框架? 24、abstract class 和 interface 有什么区别?
25.MVC 模式中 M,V,C 每个代表意义,并简述在 Struts 中 MVC 的表现方式。 26.JSP 页面之间传递参数的方法有哪些? 27.forward 和 redirect 的区别 28.Java 反射机制的作用?
29.如何提高查询效率?分别说出在数据库设计、SQL语句、java等层面的解决方案。 30.请解释分布式事务管理?
31.请写出一个超链接,点击链接后可以向 zhangsan@d-heaven.com 发送电子邮件。
32.请写出 JavaScript 中常用的三种事件。
33.请写出一段 JavaScript 代码,要求页面有一个按钮,点击按钮弹出确认框。程序可以判断出用 34.JavaScript如何实现计时功能。
35. String,StringBuffer,StringBuilder 的区别。 36.请写出 5 种常见到的 runtime exception。
37.关键字 final 分别修饰一个类,一个方法,一个变量,各起什么作用 38.是否可以继承 String 类
39.Java 异常处理中,try {}里有一个 return 语句,那么紧跟在这个 try 后的 finally {}里的 code 会不会被执行,什么时候被执行,在 return 前还是后? 40.Class.forName(String className)这个方法的作用
41.你认为在表上建立索引可以提高数据库系统的效率吗,为什么?
42.hibernate 中的 java 对象有几种状态,其相互关系如何(区别和相互转换)。
43.对 hibernate 的延迟加载如何理解,在实际应用中,延迟加载与 session 关闭的矛盾如何处理? 44.什么是 AOP 和 OOP,IOC 和 DI 有什么不同? 45.error 和 exception 有什么区别? 46.Struts2 包含哪些标签?
47、struts2 中,OGNL 访问值栈的时候查找的顺序是什么? 请排序:模型对象、临时对象、固定名称的对象、Action 对象
48、struts2 中,Action 通过什么方式获得用户从页面输入的数据,又是通过什么方式把其自身的数据49.说明工厂模式。
50.什么是数据库的参照完整性?
51.如何优化数据库,如何提高数据库的性能?
52.JS 中的三种弹出式消息提醒(警告窗口、确认窗口、信息输入窗口)的命令是什么? 53.描述 JSP 和 Servlet 的区别、共同点、各自应用的范围
54.如何获得This is first layer中的值? 55.JDK1.5 中支持的 for 循环的语法
56.简述 synchronized 和 java.util.concurrent.locks.Lock 的异同? 57.struts 中如何实现国际化,涉及哪些文件?
58.Oracle 启动中,startup nomount、 startup mount 有什么差别?
59.Oracle启动中,spfile.ora、init
60.有 2 个类 Cat 及 WhiteCat,代码如下:
public class Cat {
protected static String color = \ public Cat() { }
public void showCatColor() {
System.out.println(\
}
public static void showColor() {
System.out.println(\}
}
public class WhiteCat extends Cat {
protected static String color = \public WhiteCat() {
super(); }
public void showCatColor() {
System.out.println(\
}
public static void showColor() {
System.out.println(\}
}
请分析下面各段程序的运行结果
A.WhiteCat whiteCat = new WhiteCat(); Cat cat = whiteCat;
cat.showColor(); cat.showCatColor(); B.Cat cat = new Cat();
WhiteCat whiteCat = (WhiteCat) cat; cat.showColor(); cat.showCatColor();
C.Cat cat = new WhiteCat();
WhiteCat whiteCat = (WhiteCat) cat; cat.showColor();
cat.showCatColor();
61、说说下面语句是否有错误,或可能出现的缺陷,并指出错误,或缺陷在哪里?
public class MyFile implements Runnable{
public void run(){
while (true){ try{
FileReader fr=new FileReader(new File(\String line=fr.readLine(); System.out.println(line); }catch(IOException err) {
}
Sleep(1000);
}
}
62、判断下列语句是否正确,如果有错误,请指出错误所在?
List
解答:
错误,默认封装 int 类型。
63、判断下列语句是否正确,如果有错误,请指出错误所在?
interface A{
int add(final A a);
}
class B implements A{
long add(final A a){
return this.hashCode() + a.hashCode();
}
}
解答:
返回值不是 long 类型
64、指出下面程序的运行结果:
class A{
static{
System.out.print(\
}
public A (){
System.out.print(\}
}
class B extends A{ static{
System.out.print(\}
public B (){
System.out.print(\
} }
public class Test{
public static void main(String[] args){
A ab = new B ();
ab = new B (); }
}
解答:abxyxy
65、下列代码的输出结果是什么?
public class MyFor {
public static void main (String argv[]){
int i; int j;
outer:for(i=1;i<3;i++){inner:for(j=1;j<3;j++){
if (j==2) continue outer;
System.out .println(\
}
}
}
解答:Value for i=1 Value for j=1
Value for i=2 Value for j=1
66、查看下面的代码,写出可以使程序正常执行的修改方法
1.public class MyClass {
2.static String s1;
3. String s2;
4. public static void main(String args[]) { 5. String s3;
6.
System.out.println(\System.out.println(\System.out.println(\
7.
8.
9. }
10.}
解答:删除第 8 行或者将第 6 行改为 String s3 = \
67、写出下面代码的执行结果
public class MyClass {
static void aMethod(StringBuffer sf1, StringBuffer sf2) {
sf1.append(sf2); sf2 = sf1; }
public static void main(String[] args){
StringBuffer sf1 = new StringBuffer(\StringBuffer sf2 = new StringBuffer(\aMethod(sf1,sf2);
System.out .println(sf1+ \ } }
解答:AB:B
68、第 3 行中生成的 object 在第几行执行后成为 garbage collection 的对象? 1.public class MyClass {
2. public StringBuffer aMethod() { 3. StringBuffer sf = new StringBuffer(\4. StringBuffer[] sf_arr = new StringBuffer[1];