CSS font stacks & developer FAQs with Web standards
Site navigation below

One of hundreds of answers available with our premium content service.

Part answer

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 type
Object object = new StringBuffer("Example");

// Implicit cast to interface type
Comparable object = new File("c:\Example.txt");
      

… full answer hidden

Click for full answers

Premium members click below for full answer
What Java types are available?

Home · Web fonts · Font stacks · FAQs · Java · CSS · Javascript · HTML · Site manager