java里没有typerof ,要用instanceof
基础类型不行,要用对象
Integer i = 0;
if (i instanceof Integer) {
System.out.println(“haha”);
}
String str = “abc”;
if (str instanceof Object) {
System.out.println(“haha”);
}
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/17406.html