jeudi 17 septembre 2015

Check what java class type is this

I want to check String is interface or not using Reflection method .isInterface. Here is what I tried but it gives Class not found exception.

public class CheckingClassType {
    public static void main(String args[]) {
        try {
            Class c = Class.forName("String");
            System.out.println(c.isInterface());

        } catch (Exception e) {
            System.out.println(e);
        }

    }
}





Aucun commentaire:

Enregistrer un commentaire