public static <T> T cast(Object o, Class<T> type) {
if (type.isInstance(o)) return type.cast(o);
throw new RuntimeException("can not cast " + o.getClass() + " to '" + type);
}
Java는 Object 유형의 객체를 지정된 유형으로 변환합니다.
Supongo que te gusta
Origin blog.csdn.net/daiyi666/article/details/120107673
Recomendado
Clasificación