Fork me on GitHub

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!

posted @ 2015-11-07 18:42  ZZZZW  阅读(134)  评论(0编辑  收藏  举报
AmazingCounters.com