interface A{
public Object getName();
}
class C implements A{
public Object getName(){
String clazzName= this.getClass().getName();
return clazzName.substring(clazzName.indexOf('.')+1);
}
}
public class Exercise {
public static void main(String[] args) {
System.out.println(new C().getName());
}
}
程序 —— 返回类名称
最新推荐文章于 2024-08-26 19:56:24 发布