面试时候经常会问的一些问题(不断补充中)
面试必备基础题目(虽然不一定
常用, 仅用于面试, 面试就是把人搞的都不会然后砍价, 当然您可以讲我可以查资料完成, 但是面试的时候就是没道理的, 起码我是经常看到这些题).
如何把一段逗号分割的字符串转换成一个数组?
request.getAttribute() 和 request.getParameter() 有何区别?
response.sendRedirect() 和 forward() 区别?
<%@include file="xxx.jsp"%>
和
xml:namespace prefix = jsp />
区别?
List 和 Map 区别?
Struts 和 Spring 自动填充表单参数到 Bean 的大致原理?
说一下你用的 Spring + Hibernate 的方框图? 您都用到了哪些部分?
请用英文简单介绍一下自己.
请把 tomcat.apache.org/ 首页的这一段话用中文翻译一下?
Apache Tomcat is the servlet container that is used in the official Reference Implementation for the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed by Sun under the Java Community Process.
Apache Tomcat is developed in an open and participatory environment and released under the Apache Software License. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. We invite you to participate in this open development project. To learn more about getting involved, click here.
Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. Some of these users and their stories are listed on the PoweredBy wiki page.
try {
Connection conn = …;
Statement stmt = …;
ResultSet rs = stmt.executeQuery("select * from table1");
while(rs.next()) {
}
} catch(Exception ex) {
}
这段代码有什么不足之处?
HTML 的 form 提交之前如何验证数值不为空? 为空的话提示用户并终止提交?
为什么要用 ORM? 和 JDBC 有何不一样?
Weblogic 的 Server, Machine, Node, Domain 都有何区别?
简要讲一下 EJB 的 7 个 Transaction Level?
最常见的: 用 JDBC 查询学生成绩单, 把主要代码写出来.
Tomcat 5 用 query.jsp?name=中文, 怎么把这个变量无乱码的取出来?
finally语句一定会执行么?
前几天有一个朋友去面试,被问到这样一个问题,如下
1 public class smallT
2 {
3 public static void main(String args[])
4 {
5 smallT t = new smallT();
6 int b = t.get();
7 System.out.println(b);
8 }
9 public int get()
10 {
11 try
12 {
13 return 2 ;
14 }
15 catch (Exception e)
16 {
17 return 3 ;
18 }
19 finally
20 {
21 return 4 ;
22 }
23 }
24 }
25
输出:
4
我记得学习的时候说有返回值的方法,执行完return语句后就会停止了;另一方面我还记得在try……catch语句中fina
lly语句也是一定要执行的。于是在这里就产生了麻烦。试了一下,发现果然是执行了finally中的值。正好这两天公司在培训,我便把这个问题提给java很厉害的一个讲师,他用断点测试了一下,说是两个值都返回了……
我又改了一小下,在get方法中逐个添上了输出信息到控制台的语句,发现居然能执行。如下
1public class test
2{
3 public static void main(String args[])
4 {
5 test t = new test();
6 int b = t.get();
7 System.out.println("Third: a = "+b);
8 }
9 public int get()
10 {
11 try
12 {
13 System.out.println("First: a = "+2);
14 return 2;
15 }
16 catch(Exception e)
17 {
18 System.out.println(3);
19 }
20 finally
21 {
22 System.out.println("Second: a = "+4);
23 return 4;
24 }
25 }
26}
27
输出:
First: a = 2
Second: a = 4
Third: a = 4
可这明明是一个需要返回一个int整数的方法啊。
一道面试题目
一个整数,大于0,不用循环和本地变量,按照n,2n,4n,8n的顺序递增,当值大于5000时,把值按照指定顺序输出来。
例:n=1237
则输出为