asked 2.7k views
3 votes
Examine the following code.

Object obj = new Integer(5);

Which of the following statements is true?
The declared type of obj is Object. The actual type is also Object.
The declared type of obj is Integer. The actual type is also Object.
The declared type of obj is Object. The actual type is Integer.
The declared type of obj is Integer. The actual type is also Integer.

asked
User Vsekhar
by
7.9k points

1 Answer

2 votes
The declared type of obj is Object but it is assigned an actual Integer object type of value 5.
answered
User SomeGuy
by
8.6k points