通用方法
/** from 时代Java公众号 - nowjava.com**/ public class Main{ public static void main(String[] argv) throws Exception{ Object temp = "nowjava.com"; System.out.println(cast(temp)); } @SuppressWarnings("unchecked") public static <T> T cast(Object temp) { return (T) temp; } }