dimanche 29 octobre 2017

Class member type check using reflection

I am trying to test the type of members in class. I am finding difficulty in testing type in the following code snippet.

What should be written in the place of ??? so that the result comes true?

Class Foo {
   private Integer a;
   private Byte[] b;
}

Class FooMain {
   public static void main(String[] args) {
      Fields f = Foo.class.getDeclaredFields();
      syso(f[0].getType() == Integer.class);
      syso(F[1].getType() == ????);
   }
}





Aucun commentaire:

Enregistrer un commentaire