标签:
1 /* 2 匿名对象 3 */ 4 5 class Student 6 { 7 public static void student() 8 { 9 System.out.println("匿名对象输出测试"); 10 } 11 } 12 13 class Drive 14 { 15 public static void drive(Student s) 16 { 17 s.student(); 18 } 19 } 20 class noNameDemo 21 { 22 public static void main (String[] args) 23 { 24 new Drive().drive(new Student()); //只可单次使用 25 } 26 }
标签:
原文地址:http://www.cnblogs.com/x3408/p/5700542.html