I was just reading over some Java code and asked myself why this piece of code:
int my_int = 100;
Long my_long = Integer.my_int.longValue();
would not work giving me the error, "my_int can not be resolved or is not a field" ; however this code would work:
Integer my_integer = new Integer(100);
Long my_long = my_integer.longValue();
Please explain!
Integer.my_int.longValue()should do and why?Integer.my_int.longValue();should be((Integer)my_int).longValue();Integer.valueof(my_int).longValue();