zoukankan      html  css  js  c++  java
  • 3. Java面向对象之泛型-指定多个泛型

    3. Java面向对象之泛型-指定多个泛型


    package generic;


    class MutiGeneric<K, T> {
    private K key;
    private T take;


    public K getKey() {
    return key;
    }


    public void setKey(K key) {
    this.key = key;
    }


    public T getTake() {
    return take;
    }


    public void setTake(T take) {
    this.take = take;
    }


    }


    public class genricDemo02 {


    public static void main(String[] args) {
    MutiGeneric<Integer, String> g = new MutiGeneric<Integer, String>();
    g.setKey(10);
    g.setTake("多個泛型的使用");
    System.out.println(g.getKey() + g.getTake());


    }


    }

    版权声明:本文为小平果原创文章,转载请注明:http://blog.csdn.net/i10630226

  • 相关阅读:
    python中的time模块
    CSS 布局
    8 Function类型
    2 node 核心
    1 node 简介
    13 对象
    JS 算法一
    JS 模块化
    1 谈谈section标签
    JS 练习一
  • 原文地址:https://www.cnblogs.com/dingxiaoyue/p/4948264.html
Copyright © 2011-2022 走看看