In Java, int and Integer are not same. One is a datatype where as the other is Wrapper class.

Similarly, we have wrapper classes for various data types as follows:

int --> Integer
long --> Long
short --> Short
byte --> Byte
char --> Character
double --> Double
float --> Float
boolean --> Boolean

With the help of wrapper classes, one can even know the range the datatype accepts. For example, if you want to print range for int, we can do as follows:

System.out.print("Range of int datatype is : " + Integer.MIN_VALUE + " to " + Integer.MAX_VALUE);

All the posts are written with lots of love for our readers.. We would love to see you sharing our posts. We never spam with wrong content.. You can happily depend on our content. With lots of love @Editor, Swapnamithra. Copyright reserved .

Post a Comment