+ 1
comparing object with class
how to comparing object with class? without create instance of class. for exemple: class A {} class B extends A {} main() { B b = new B(); A a = (A) b; //how to check that a is an instance of B class }
3 Réponses
+ 5
Java has instanceof operator that is supposed to do what you want.
See here https://www.geeksforgeeks.org/java-instanceof-and-its-applications/
+ 2
👍👍👍
+ 1
yeah thats right thanks a lot :)