KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > InstanceOf


1 public class InstanceOf {
2
3     public static void main(String JavaDoc [] args){
4         InstanceOf i = new InstanceOf();
5         i.run("S");
6     }
7     
8     public void run(Object JavaDoc o){
9         if (o instanceof String JavaDoc){
10             String JavaDoc s = (String JavaDoc)o;
11             String JavaDoc y = s + s;
12         }
13         Object JavaDoc n = new Object JavaDoc();
14     }
15 }
16
Popular Tags