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();

  • 相关阅读:
    幻灯片效果
    国外空间乱码的解决方法
    图片自动适应
    css圆角效
    iframe自适应兼容
    css圆角
    图片自动适应2
    JQuery实现智能输入提示(仿机票预订网站)
    AppDiag类
    c# 渐变算法
  • 原文地址:https://www.cnblogs.com/attilax/p/5964092.html
Copyright © 2011-2022 走看看