What We Are Learn On This Post
How to use instanceof Method in Java With Example Program?
package com.java.Softwaretestingblog; public class InstanceOfEx { public static void main(String[] args) { // TODO Auto-generated method stub InstanceOfEx obj=new InstanceOfEx(); if(obj instanceof InstanceOfEx) { System.out.println("Object Belongs to That Class"); } else { System.out.println("Object No Belongs to That Class"); } } }
Check Also: Compare two Objects Using Hashcode In Java
Java Output:
Object Belongs to That Class
Leave a Reply