• paip。java 高级特性 类默认方法,匿名方法+多方法连续调用, 常量类型


    paip。java 高级特性 类默认方法,匿名方法+多方法连续调用, 常量类型

    作者Attilax 艾龙,  EMAIL:1466519819@qq.com
    来源:attilax的专栏
    地址:http://blog.csdn.net/attilax


    /6.1    常量类型

    idx = "book.txt".find("txt")


        public static <T> T $(T t) {
                 return t;

            }
            
            
    /多方法连续调用
    new global().multiMethod1("aa").multiMethod2("22");

        public <T> global multiMethod1(T t)
        {
            System.out.println( " mtd1 ");
            return this;
            
        }
        public <T> global multiMethod2(T t)
        {
            System.out.println( " mtd2 ");
            return this;
            
        }
        
        6.8    类默认方法,对象即函数,默认方法.

    调用car.$("o1 13");
    ---------实现-------------
    public static void $(String s)
        {    
             System.out.println("defalut method:"+ s);
            
        }
        
    //6.9    匿名方法(方法内部匿名类)
        
    String c = new ccParser() {

                public String t() {
                    return "haoa 012";
                }

            }.t();

  • 相关阅读:
    k8s创建rabbitmq集群
    k8s创建redis集群
    azure devops server自动生成容器镜像部署到k8s
    azure devops 自动编译生成项目
    部署 Kubernetes 高可用集群
    camstar 服务健康检查和故障自动恢复
    keepalived 配置
    解决k8s namespace terminating无法删除的问题
    kong网关dbless模式
    camstar MES开发分享
  • 原文地址:https://www.cnblogs.com/attilax/p/15199335.html
Copyright © 2020-2023  润新知