Forums Java Help What is the difference between Integer and int?

This topic contains 1 reply, has 1 voice, and was last updated by  Aakanksha 8 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7362

    Aakanksha
    Participant

    What is the difference between Integer and int?

    #11941

    Aakanksha
    Participant

    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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.