Solution #1:
Which types can you use for variables but not for Types in Java?
Class types, interface types, and array types can be used for variables but not for values in Java. A value must be a reference to an Object of a class or a reference to an array.
Question #2:
When do you use a wrapper class for a primitive type?
Whenever you need to supply a primitive type value to services/methods which require Objects.
Question #3:
Together, lets write a method called dumpArray that prints the elements of an array to System.out, using toString() on array elements if the elements are objects
public void dumpArray(Object[] array)
{
int loop = 0;
for (Object obj:array)
{
if (obj instanceof Object)
{
System.out.println(obj.toString());
loop++;
}
else
{
System.out.println(array[loop]);
loop++;
}
}
}