mardi 10 octobre 2017

How to use instanceof operator in java where the class is not known beforehand? [duplicate]

This question already has an answer here:

I am trying the following code

public static boolean causeContains(Exception exception, Class type)
    {
        if (exception instanceof type)
        {
            ....
        }
    }

I got unknown class: type. My goal is to create a function to recursively find if an exception contains a specific type of another exception.





Aucun commentaire:

Enregistrer un commentaire