首页 > 其他 > 详细

匿名对象

时间:2016-07-24 13:19:52      阅读:196      评论:0      收藏:0      [点我收藏+]
 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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!