instanceof的用法①
生活随笔
收集整理的這篇文章主要介紹了
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!
轉載于:https://www.cnblogs.com/zzzzw/p/4945864.html
總結
以上是生活随笔為你收集整理的instanceof的用法①的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 孕妇梦到屎拉裤子里是什么意思
- 下一篇: 用模版实现简单的内存池