![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java
文章平均质量分 76
whujl
这个作者很懒,什么都没留下…
展开
-
JAVA Autoboxing机制
今天在CarrerCup上看到这么一道面试题: [LinkedList]What's wrong with the code below under JDK 1.4? Fix it. How about JDK 1.5? LinkedList[] ll = new LinkedList[3]; ll[1].add(1); ll[1].add("red"); ll[2].add(原创 2012-08-19 19:20:15 · 329 阅读 · 0 评论 -
static关键字
static修饰属性:无论一个类生成了多少对象,所有这些对象共同使用唯一一份静态的成员变量;一个对象对该静态成员变量进行了修改,其他对象的该变量值也会随之改变。 static修饰方法:static修饰的方法叫做静态方法,对于静态方法可以直接用类名.方法名来访问。静态方法主要用处是在不创建任何对象的前提下就可以调用该方法,比如main()方法。 静态方法只能继承,不能重写(Ove原创 2012-08-30 19:08:42 · 147 阅读 · 0 评论 -
static代码块
public class StaticTest{ public static void main(String[] args){ P p1 = new P(); P p2 = new P(); } } class P{ static{ System.out.println("static block"); } public P(){ System.out.printl原创 2012-09-03 19:24:25 · 154 阅读 · 0 评论