淘先锋技术网

首页 1 2 3 4 5 6 7

java面试题网站:www.javaoffers.com

#switch 支持的类型有哪些(这个没记住)

            答案 byte  short  int  char   (jdk1.6支持String)

#  写出下面程序打印的结果(返回true还是false)

    Integer two = new Integer(2);
    Integer two_ = new Integer(2);

  答案:== 在基础类型使用时,比较基础类型的值引用类型使用时,比较的是内存地址基础类型和引用类型在一起使用==时,引用类型会自动转为基础类型,然后开始比较。      
        System.out.println(2==2);//true
        System.out.println(two == 2);//true
        System.out.println(two_ == 2);//true                                                                                                                                                       System.out.println(two == two_);//false

#下面batis中哪里出现错误

<mapper namespace="BASE">
 <select id="queryZhiLianData" resultMap="map">
  select username from user a where a.id=#{id}
 </select>
</mapper>

答案: 在mapper中没有声明<resultMap id="map"></resultMap>,经过我测试会报错,这里一定要和resultType区分开,在开发时经常使用resultType="map",所以忽略掉了resultMap,(本人在回答时说的是paramType缺失,面试官回答说paramType缺失对这个不影响,回去我自己写了一下,还真的不影响。参数我传入的是一个Map对象,依然可以#{id} 获取Map对象中的value。)