package com.shrimpking.t6;

import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Shrimpking
 * @create 2024/10/1 12:17
 */
class Graph2<T>{
    private T shape;

    public T getShape(){
        return this.shape;
    }

    public void setShape(T shape){
        this.shape = shape;
    }
}

public class GenericDemo8_4
{
    public static void main(String[] args)
    {
        //泛型,不同实例
        Graph2<String> gaStr = new Graph2<>();
        Graph2<Integer>  gaInt = new Graph2<>();

        gaStr.setShape("circle");
        gaInt.setShape(999);

        System.out.println("ga_str is :" + gaStr.getClass().getName());
        System.out.println(gaStr.getShape());

        System.out.println("gs_int is :" + gaInt.getClass().getName());
        System.out.println(gaInt.getShape());

    }
}