I am new to java and was trying to implement the isInstance() in a particular exception handling scenario.
try {
....
..//some condition
throws MyException(); // --> MyException extends RuntimeException
}catch(Exception e){
if(e.getClass().isInstance(MyException.class)) // --> This returns false
.. //do something
}
The above isInstance() returns false. When I debug, e.getClass() has a value :
in.soumav.exceptions.MyException (id=133)
and MyException.class has value:
in.soumav.exceptions.MyException (id=133)
Which concept am I missing at?