- abstract class Student
- {
- abstract void speak();
- }
- class Teacher
- {
- void look(Student stu)
- {
- stu.speak();
- }
- }
- public class example2 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Teacher zhang = new Teacher();
- zhang.look(new Student()
- {
- void speak()
- {
- System.out.println("this is ...");
- }
- }
- );
- }
- }
复制代码
看不明白这是怎么回事,呜呜。。 |
|