Thursday, 24 January 2019

What is the difference between Integer and int

What is the difference between Integer and int?

Answer:

a) Integer is a class defined in the java. lang package, whereas int is a primitive data type defined in the Java language itself. Java does not automatically convert from one to the other.

b) Integer can be used as an argument for a method that requires an object, whereas int can be used for calculations.

No comments:

Post a Comment