zoukankan      html  css  js  c++  java
  • 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();

  • 相关阅读:
    SpringBoot打包 jar文件太小 无jar
    公共dns
    SpringBoot解决跨域问题
    git学习-来自慕课网
    SpringBoot Value 'xxx' is not a valid duration
    Maven生成项目
    github-自我使用-滑稽
    jsonp示列
    mysqldump 备份和恢复整理
    myql二进制日志
  • 原文地址:https://www.cnblogs.com/attilax/p/5964092.html
Copyright © 2011-2022 走看看