Explain the difference between Integer and int in java.The following are the differences:
- Integer is a wrapper class, where as int is a primitive data type.
- Integer can be used as an argument to a method which requires an object, where as int can be used as an argument to a method which requires an integer value, that can be used for arithmetic expression.
- The variable of int type is mutable, unless it is marked as final. Integer class contains one int value and are immutable.Explain the difference between Integer and int in java. int is one of the primitive datatype in Java. The Integer class wraps a value of the primitive type int in an object. An object of type Integer contains a single field whose type is int.
|