![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
我的面试经历及题目
文章平均质量分 58
深圳-夏凯
这个作者很懒,什么都没留下…
展开
-
try中return问finally是否执行
public class Test { public static void main(String[] args) { System.out.println(new Test().test()); } public static int test() { int i = 1; try { return i; // 此时执行了return 语句返回值已经确定了,但是该方法原创 2014-08-26 18:33:19 · 375 阅读 · 0 评论 -
String和StringBuffer深入解析
上一位老兄说的为什么也还要用String;请看这段文字; 而在某些特别情况下, String 对象的字符串拼接其实是被 JVM 解释成了 StringBuffer 对象的拼接,所以这些时候 String 对象的速度并不会比 StringBuffer 对象慢,而特别是以下的字符串对象生成中, String 效率是远要比 StringBuffer 快的: String S1 = “This i转载 2014-08-26 19:17:12 · 284 阅读 · 0 评论 -
int 和integer的区别
int是java提供的8种原始数据类型之一。 Java为每个原始类型提供了封装类,Integer是java为int提供的封装类。 int的默认值为0,而Integer的默认值为null,即Integer可以区分出未赋值和值为0的区别,int则无法表达出未赋值的情况, 例如,要想表达出没有参加考试和考试成绩为0的区别,则只能使用Integer。在JSP开发中,Integer的默认为null,所转载 2014-08-27 09:27:52 · 405 阅读 · 0 评论 -
Integer与int的种种比较你知道多少?
如果面试官问Integer与int的区别:估计大多数人只会说道两点,Ingeter是int的包装类,int的初值为0,Ingeter的初值为null。但是如果面试官再问一下Integer i = 1;int ii = 1; i==ii为true还是为false?估计就有一部分人答不出来了,如果再问一下其他的,估计更多的人会头脑一片混乱。所以我对它们进行了总结,希望对大家有帮助。 首先看代转载 2014-08-27 09:42:34 · 345 阅读 · 0 评论 -
equals和 hashcode比较
2012-02-14 15:13 905人阅读 评论(0) 收藏 举报 equalsobjectjava算法integer存储 Java中== equals hashcode浅析: 1. '=='是用来比较两个变量(基本类型和对象类型)的值是否相等的, 如果两个变量是基本类型的,那很容易,直接比较值就可以了。如果两个变量是对象类型的,那么它还是比较值,只是它比较的是这两个对象在栈中的转载 2014-08-27 09:12:23 · 330 阅读 · 0 评论 -
Java String对象的经典问题(new String())
Java代码 public class Test { public static void main(String[] args) { String str = "abc"; String str1 = "abc"; String str2 = new String("abc");转载 2014-08-27 09:18:32 · 429 阅读 · 0 评论 -
统计字符串中字母个数(用treeMap)
import java.util.*; public class MapTest { public static void main(String args[]){ String str = "fdg+avAdc bs5dDa9c-dfs"; getCharacterCount(str); showCharacterCount(); } private static Tre原创 2014-08-27 21:56:34 · 826 阅读 · 0 评论 -
TreeSet实现自定义排序
import java.util.*; /* ** TreeSet排序方式 ** 1.元素实现Comparable接口,具备可比性 ** 2.new TreeSet(Comparable com); //内部类 */ public class TreeDemo { public static void main(String args[]){ sortMethod2(); }原创 2014-08-27 18:42:07 · 543 阅读 · 0 评论 -
Collections工具类方法回顾以及自定义实现
import java.util.*; public class CollectionsDemo { public static void main(String args[]){ method1(); demo_2(); demo_3(); demo_4(); } public static void demo_4() { List list = new ArrayLi原创 2014-08-27 22:47:16 · 550 阅读 · 0 评论