Interview Question

Interview(Student Candidate) Durham, NC

Difference between int and Integer in Java. (Phone screen


Interview Answer

1 Answer


int is a primitive type value and a variable declared as int type is immutable where is Integer on the other hand belongs to Object class and we can call methods on a variable of Integer type. eg: int i; Integer j; String s = i.toString(); //fails String s = j.toString(); //works

Chaitanya on Nov 24, 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.