samedi 12 mars 2016

boolean.isInstance(true) is false?

Problem

The Class Object of a boolean Field does not recognize other booleans as instances.

Code

public class Test {
    public boolean b;
    public static void main(String[] args) {
        System.out.println(Test.class.getFields()[0].getType().isInstance(true));
    }
}

Result

false





Aucun commentaire:

Enregistrer un commentaire