摘要: 定义格式:1 class Outer{2 class Inner{3 public void show(){4 System.out.println("Run...");5 }6 }7 }内部类访问特点:1.内部类可以直接访问外部类中的成员;2.外部类要访问内部类,必须简历内部类的对象。内部类使用环境:分析事物时,发现该事物描述中还有事物,而且这个事物还在访问被描述事物的内容,这时还有的事物定义成内部类来描述。修饰符: 因为内部类是在外部类内中,相当于是外部类的成员,所以会有成员修饰符:public default pri... 阅读全文
posted @ 2012-10-23 19:09 洒洒 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 1 public class NeiBu { 2 public static void main(String[] args) { 3 System.out.println("Hello,This is Function main..."); 4 Zi z = new Zi(); 5 z.show(); 6 } 7 } 8 9 class Fu{10 public static void show(){11 System.out.println("Fu static...");12 }13 }1... 阅读全文
posted @ 2012-10-23 17:31 洒洒 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 多态:多态在代码中的体现:父类或者接口的引用指向其子类的对象。多态代码演示: 1 public class NeiBu { 2 public static void main(String[] args) { 3 System.out.println("Hello,This is Function main..."); 4 method(new Dog()); 5 } 6 7 public static void method(Animal a){//Animal a = new Dog(); 8 a.eat(); 9 ... 阅读全文
posted @ 2012-10-23 16:59 洒洒 阅读(193) 评论(0) 推荐(0) 编辑