One of hundreds of answers available with our premium content service.
A: There are two main divisions of data types in Java: object and primitive types. Object types are declared according to their class.
Object object = new Object();
Objects can also be cast to a more general superclass or interface type. Java type cast behaviour is part of a general scheme of object substitution called polymorphism, in which an object “behaves like” and can be “treated as” an instance of another type.
// Implicit cast to object typeObject object =newStringBuffer("Example");// Implicit cast to interface typeComparable object =newFile("c:\Example.txt");
… full answer hidden
Premium members click below for full answer
What Java types are available?