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.

User Vsekhar
by
5.2k points

1 Answer

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