举例:判断返回值是否是枚举值类型
public class Test {

public enum ColorSelect {
red, green, yellow, blue;
}
private static ColorSelect getE()
{
ColorSelect c=ColorSelect.blue;
return c;
}
public static void main(String[] args) {
Object o=getE();
if(o instanceof Enum)
{
System.out.println(o);
}
}
}

相关文章:

  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案