Organizational Research By

Surprising Reserch Topic

does int class equal integer class or integer type in java using -'java,reflection,primitive-types,boxing'


does int class equal integer class or integer type in java  using -'java,reflection,primitive-types,boxing'

Let's imagine one retrieves the declaring type of a Field using reflection.

Which of the following tests will correctly indicate whether one is dealing with an int or an Integer?

Field f = ...
Class<?> c = f.getDeclaringClass();
boolean isInteger;

isInteger = c.equals(Integer.class);
isInteger = c.equals(Integer.TYPE);
isInteger = c.equals(int.class);

isInteger = ( c == Integer.class);
isInteger = ( c == Integer.TYPE);
isInteger = ( c == int.class);

    
asked Sep 7, 2015 by rajesh
0 votes
9 views



Related Hot Questions



Government Jobs Opening


...