O'Reilly logo

Java 2™ Programmer Exam Cram™ 2 (Exam CX-310-035) by Marcus Green, Bill Brogden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Converting and Casting Reference Types

Java has three kinds of reference type variables: class type, interface type, and array type. A variable of type Object can hold a reference to any of these three types because Object is the root of the Java object hierarchy. This point is important because a Java method that is passed an Object reference may have a reference to just about anything.

In contrast to converting and casting primitives, converting and casting a reference to a variable does not change the object being referred to. Once created, an object can be referred to in a variety of ways, but the object type is not changed. However, the reference ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required