自由飞翔

我在仰望,java之上

统计

留言簿(2)

我关注的blog

阅读排行榜

评论排行榜

易宝支付面试题(根据网上总结)

1.public class TestKnowleage5 {
public static void main(String[] args){
String strValue = "ABCDEFG";
strValue.substring(3);
System.out.println("result1"+strValue);
strValue.concat("123");
System.out.println("result2"+strValue);
String value = new String("ABCDEFG");
System.out.println(strValue==value);
}
}

运行结果:
result1ABCDEFG
result2ABCDEFG
false
2.public class Test{
    public static void main(String[] args){
         int x = 100;
int y = 200;
if(x == y)
System.out.println("not equal");
else
System.out.println("equal");
    }
}

运行结果:
equal

3.public class TestKnowleage5 {
public static void main(String[] args){
try{
new TestKnowleage5().methodA(5);
}catch(IOException e){
System.out.println("caught IOException");
}catch(Exception e){
System.out.println("caught Exception");
}finally{
System.out.println("no Exception");
}
}
public void methodA(int i) throws IOException{
if(i%2 != 0){
throw new IOException("methodA IOException");
}
}
}

运行结果:
caught IOException
no Exception

4.public class TestKnowleage5 {
static boolean isTrue(){
System.out.println("isTrue");
return true;
}
static boolean isFalse(){
System.out.println("isFalse");
return false;
}
public static void main(String[] args){
if(isTrue() || isFalse()){
System.out.println("|| operate return true");
}
if(isFalse() & isTrue()){
System.out.println("& operate return true");
}
}
}

运行结果:
isTrue
|| operate return true
isFalse
isTrue

5.public class TestKnowleage5{
public static void main(String args[]){
MyThread t = new MyThread();
t.run();
t.start();
System.out.println("A");
}
}
class MyThread extends Thread{
public void run(){
try{
Thread.currentThread().sleep(3000);
}catch(InterruptedException e){
}
System.out.println("B");
}
}
运行结果:
BBA或
BAB
6.class A{
void fun1(){
System.out.println(fun2());
}
int fun2(){
return 123;
}
}
public class TestKnowleage5  extends A{
int fun2(){
return 456;
}
public static void main(String[] args){
A a;
TestKnowleage5 b = new TestKnowleage5();
b.fun1();
a = b;
a.fun1();
}
}

运行结果:
456
456
7.class A{
int val;
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
}
public class TestKnowleage5{
public static void main(String[] args){
A data = new A();
ArrayList list = new ArrayList();
for(int i=100;i<103;i++){
data.setVal(i);
list.add(data);
}
int j = 0;
while(j<list.size()){
A tmp = (A)list.get(j);
System.out.println("list("+j+")="+tmp.getVal());
j++;
}
}
}

运行结果:
list(0)=102
list(1)=102
list(2)=102

8.hibernate导入大量数据时,为了避免内存中产生大量对象,在编码时注意什么,如何去除?

9.视图与表的区别
10.触发器有哪几种类型
11.
事务操作有那几个步骤
12.写出对应正则表达式:
1)1-6位字母或数字;
[a-zA-Z0-9]{1,6}
2)手机号(只能是139或159开头,11位数字)
1[35][9][0-9]{8}
13.字符串反转:new StringBuilder(str).reverse().toString();
14.写程序:1+2²+3²+...+n²
int func(int n){
    return n==1?1:func(n-1)+n*n
}

15.写一个延迟加载的单例模式:
public class SingleTon{
    private static  SingleTon  instance = null;
    private SingleTon(){}
    public static SingleTon getInstance(){
        if(instance == null){
                synchronized(""){
                    if(instance == null){return new SingleTon();}
                }
        }
        return instance;
    }
}

16.
JSP的9种内置对象:
request:
HttpServletRequest类的实例,
客户端的请求信息被封装在request对象中
response:
HttpServletResponse类的实例,
response对象包含了响应客户请求的有关信息,但在JSP中很少直接用到它。
out:
out对象是JspWriter类的实例,是向客户端输出内容常用的对象
session:
session对象指的是客户端与服务器的一次会话,从客户端连到服务器的一个WebApplication开始,直到客户端与服务器断开连接为止。它是HttpSession类的实例
page:
page对象就是指向当前JSP页面本身,有点象类中的this指针,它是java.lang.Object类的实例
application:
ServletContext类的实例,
application对象实现了用户间数据的共享,可存放全局变量。它开始于服务器的启动,直到服务器的关闭
exception:
exception对象是一个例外对象,当一个页面在运行过程中发生了例外,就产生这个对象。如果一个JSP页面要应用此对象,就必须把isErrorPage设为true,否则无法编译。他实际上是java.lang.Throwable的对象
pageContext:
pageContext对象提供了对JSP页面内所有的对象及名字空间的访问,也就是说他可以访问到本页所在的SESSION,也可以取本页面所在的application的某一属性值,他相当于页面中所有功能的集大成者,它的本类名也叫pageContext
config:
config对象是在一个Servlet初始化时,JSP引擎向它传递信息用的,此信息包括Servlet初始化时所要用到的参数(通过属性名和属性值构成)以及服务器的有关信息(通过传递一个ServletContext对象)
17.session和cookie的区别?
18.JDBC的操作步骤?


Gavin

posted on 2012-04-11 11:32 GavinMiao 阅读(1523) 评论(0)  编辑  收藏 所属分类: 面试题


只有注册用户登录后才能发表评论。


网站导航: