java匿名类没有函数名的花括号

来源:互联网 发布:数据库表怎么设计 编辑:程序博客网 时间:2024/06/05 16:45
package test;import java.util.Properties;public class Test1 {public static void main(String[] args) {Properties p = new Properties(){{put("url","wwwww");put("OK","dddddd");}};System.out.println(p);A a = new A(){int a = 100;{System.out.println(a);f();}}; }}class A{public void f(){System.out.println("A::f");}}

0 0
原创粉丝点击