遇到过的JAVA面试题

1、List, Set, Map的区别

List,Set继承于Colletions, Map另外。有序/无序、唯一/不唯一

2、String系列问题

参考String博文

3、ArrayList, Vector;HashMap,HashTable的区别,(线程)

4、ClassLoader相关问题

5、Java反射机制(学习)

6、一个实例设计模式

实现一:

public class Singleton { 
  private static Singleton s;
  private Singleton(){};
  /**
   * Class method to access the singleton instance of the class.
   */
  public static Singleton getInstance() {
    if (s == null)
      s = new Singleton();
    return s;
  }
}

实现二:

class SingletonException extends RuntimeException {
  public SingletonException(String s) {
    super(s);
  }
}
class Singleton {
  static boolean instance_flag = false; // true if 1 instance
  public Singleton() {
    if (instance_flag)
      throw new SingletonException("Only one instance allowed");
    else
      instance_flag = true; // set flag for 1 instance
  }
}
在多线程的程序中,singleton可能会出现多个实例,解决的办法很简单,加个同步修饰符: public static synchronized Singleton getInstance() 这样就保证了线程的安全性。

7、重写与重载

8、EJB的LifeCycle

9、数据库编程(学习)

查询每门课程最高分的学生成绩

select   *   from   表   a
where   not   exists(
        select   *   from   表   where   学生id   =   a.学生id   and   分数> a.分数)

10、ArrayList和LinkedList的区别(数组、链表;查找快、修改快)

11、JVM的性能优化、ClassLoader

12、已排序数组A[],从位置K截断(K任意)后,将K之前的部分补到原数组的最后。

编写查找算法程序。参考二分查找,递归思想。每次比较n/2,最大和最小位置。

13、递归和非递归求解二叉树,前中后序遍历、层序遍历、兄弟节点连接。

14、数据库优化方法

索引、数据搜索结果缓存

15、request.getRequestDispatch()和response.sendRedirect()的区别

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值