what is instanceof java code example

Example 1: instanceof java

class Example{  
  
 public static void main(String args[]){  
   
 Example anexample=new Example();  
 System.out.println(anexample instanceof Example);
   
 }  
  
}

Example 2: what is an instance in java

Instance variables in Java are non-static variables which are defined in a class outside any method, constructor or a block. Each instantiated object of the class has a separate copy or instance of that variable. An instance variable belongs to a class.

Tags:

Misc Example