package com.shrimpking.t6;
/**
* Created by IntelliJ IDEA.
*
* @Author : Shrimpking
* @create 2024/10/1 12:12
*/
class Graph<T>{
//自定义泛型
private T shape;
public T getShape(){
return this.shape;
}
public void setShape(T shape){
this.shape = shape;
}
}
public class GenericDemo8_3
{
public static void main(String[] args)
{
Graph<String> ga = new Graph<>();
ga.setShape("circle");
System.out.println("shape:" + ga.getShape());
}
}
GenericDemo8_3
最新推荐文章于 2025-01-16 23:44:38 发布
31

被折叠的 条评论
为什么被折叠?



