instanceof的用法①

 1 public class typeof1{
 2     private String a="zzw";
 3     public void instance(){
 4         if(a instanceof String) //判断是不是String类型的
 5         {
 6             System.out.println("hello world!");
 7         }
 8     }
 9     public static void main(String args[]){
10         new typeof1().instance();
11     }
12 }

运行结果:

hello world!

---- 动动手指关注我!或许下次你又能在我这里找到你需要的答案!ZZZZW与你一起学习,一起进步!
原文地址:https://www.cnblogs.com/zzzzw/p/4945864.html