Java_01_知识点
文章平均质量分 76
xxzj9067
这个作者很懒,什么都没留下…
展开
-
Java7中的switch支持String的实现细节
Java7中的switch支持String的实现细节 作者: zsxwing 更新: 2013-03-04 21:08:02 发布: 2012-04-26 13:58:19 在Java7之前,switch只能支持 byte、short、char、int或者其对应的封装类以及Enum类型。在Java7中,呼吁很久的String支持也终于被加上了。转载 2017-04-08 09:52:23 · 203 阅读 · 0 评论 -
为何非静态内部类不能有静态成员
首先要弄清楚非静态内部类的概念。 非静态内部类如下: public class Outer { class Inner { //public static int si = 1;错误,不允许存在静态的内部成员 public static final int i = 1; } public static void main(String[] ar转载 2017-04-07 23:09:17 · 706 阅读 · 0 评论 -
加载一个类时,其内部类是否同时被加载?引申出单例模式的另一种实现方式
加载一个类时,其内部类是否同时被加载?下面我们做一个实验来看一下。 Java代码 1. public class Outer { 2. static { 3. System.out.println("load outer class..."); 4. } 5. 6. /转载 2017-04-07 12:11:12 · 386 阅读 · 0 评论 -
what is difference between equals() and contentEquals() of String class?
what is difference between equals() and contentEquals() of String class? posted 4 years ago what is the difference between below 2 methods of String class:转载 2017-04-09 23:11:32 · 414 阅读 · 0 评论 -
Thread.Sleep 函数
我们可能经常会用到 Thread.Sleep 函数来使线程挂起一段时间。那么你有没有正确的理解这个函数的用法呢?思考下面这两个问题: 假设现在是 2008-4-7 12:00:00.000,如果我调用一下 Thread.Sleep(1000) ,在 2008-4-7 12:00:01.000 的时候,这个线程会 不会被唤醒? 某人的代码中用了一句看似莫明其妙的话:Thread.Sleep(转载 2017-04-10 08:36:33 · 1668 阅读 · 0 评论