Interview Question

Quality Assurance Engineer Interview(Student Candidate) Durham, NC

Difference between int and Integer in Java. (Phone screen

  question)
Answer

Interview Answer

1 Answer

0

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.