package Ijiekou;public class Telephone implements IPsp { ?? ? ?public void Play(){? ? ?System.out.println("123");? ? ?? ? ?} ?public static void main(String[] args) {? ? new IPsp(){? ? ?public void Play(){? ? ? ?System.out.println("456");? ? ? ? }}.Play();? ? ?}}關于這段代碼是將匿名內部類在寫main方法中的,我看網上好多博客講到匿名內部類也可以在成員變量中定義,可是為什么我把這段代碼剪貼到成員變量就發生錯誤了呢。
添加回答
舉報
0/150
提交
取消