zoukankan      html  css  js  c++  java
  • 【泛型接口】

    package com.yjf.esupplier.common.test;
    
    /**
     * @author shusheng
     * @description
     * @Email shusheng@yiji.com
     * @date 2018/12/13 16:27
     */
    public interface Inter<T> {
    
        public void show(T t);
    }
    
    
    package com.yjf.esupplier.common.test;
    
    /**
     * @author shusheng
     * @description
     * @Email shusheng@yiji.com
     * @date 2018/12/13 16:28
     */
    public class InterImpl<T> implements Inter<T> {
    
        @Override
        public void show(T t) {
            System.out.println(t);
        }
    }
    
    
    package com.yjf.esupplier.common.test;
    
    /**
     * @author shusheng
     * @description
     * @Email shusheng@yiji.com
     * @date 2018/12/13 16:48
     */
    public class InterDemo {
        /**
         * 泛型接口:
         * 把泛型定义在接口上
         * 格式:public   interface 接口名<泛型类型 1…>
         */
        public static void main(String[] args) {
    
            Inter<String> inter1 = new InterImpl<String>();
            inter1.show("hello");
    
            Inter<Integer> inter2 = new InterImpl<Integer>();
            inter2.show(30);
    
        }
    
    }
    终身学习者
  • 相关阅读:
    课程总结
    每日总结66
    每日总结65
    每日总结64
    每日总结63
    每日总结62
    每日总结61
    每日总结60
    偶滴点NET复习
    内部异常SocketException由于目标计算机积极拒绝
  • 原文地址:https://www.cnblogs.com/zuixinxian/p/11275062.html
Copyright © 2011-2022 走看看