Java - (Data Type|Type)

Java Conceptuel Diagram

About

data type in the java world.

The Java programming language is statically-typed, which means that all variables must first be declared before they can be used.

Type

The language supports four kinds of types:

The first three are known as reference types. Class instances and arrays are objects; primitive values are not.

Glossary

Supertype

A supertype is a class that is extended by an other class. See Java - (Inheritance|Class Hierarchy) - (Subclass|Superclass) - (Extends, Super) - ( is a relationship). This is hierarchic relationship.

In object-oriented terminology, this is called an “is a” relationship.

Example: As:

The following code is allowed:

Object someObject = new Object();
Integer someInteger = new Integer(10);
someObject = someInteger;   // OK

public void someMethod(Number n) { /* ... */ }
someMethod(new Integer(10));   // OK
someMethod(new Double(10.1));   // OK

Subtype

Same as supertype but in the other direction.

A Subtype is a class that extends an other class.

Interface

Interface are abstract data type. When you define a new interface, you are defining a new reference data type. You can use interface names anywhere you can use any other data type name. If you define a reference variable whose type is an interface, any object you assign to it must be an instance of a class that implements the interface.

As an example, here is a method for finding the largest object in a pair of objects, for any objects that are instantiated from a class that implements Relatable:

public Object findLargest(Object object1, Object object2) {
   Relatable obj1 = (Relatable)object1;
   Relatable obj2 = (Relatable)object2;
   if ( (obj1).isLargerThan(obj2) > 0)
      return object1;
   else 
      return object2;
}

By casting object1 to a Relatable type, the can invoke the isLargerThan method that is define in the Relatable interface.

Generic

Generic

Documentation / Reference





Discover More
Java Conceptuel Diagram
Generic

and Integer.class is of type Class Stronger type checks at compile time. Fixing compile-time errors is easier than fixing runtime errors, which can be difficult to find. The compiler can check the type...
Card Puncher Data Processing
JPA - Column Mapping

This article is the mapping of a column without relationship Every JPA entity must have a primary key. A basic attribute is one where the attribute class (datatype) is a simple type such as: ...
Card Puncher Data Processing
JPA - Primary Key (@Id, @IdClass, )

Every JPA entity must have a primary key. A primary key corresponds to one or more fields or properties (“attributes”) of the entity class. A simple (i.e., non-composite) primary key must correspond...
Java Conceptuel Diagram
JSF - How to create a simple (JSF Data Table|ADF Table)

How to create a data table with Eclipse OEPE ? The managed bean with a variable of the type enumerable. Note that Enumerable types include type java.util.Collection, java.util.Iterator,...
Java Conceptuel Diagram
Java - (Class|Object|Member) (Initialization|Instantiation)

Class (Initialization|Instantiation) in java. During an class initialization: Java's class loader loads the main method Java's byte code verifier verifies the class. The first initialization...
Java Conceptuel Diagram
Java - (Enumerable|Iterator) Data Type (Iterable interface)

The (Enumeration|Iterator) interface defines the methods by which you can: iterate enumerate obtain one at a time the elements of a collection. The Enumerator Interface: has been deprecated...
Java Conceptuel Diagram
Java - (Field|Member Variable)

A field is a variables in a class and they are used to contain state information. They are also known as member variable. A member that is not declared as static is implicitly an instance member. ...
Java Conceptuel Diagram
Java - (Primitive|Native) Data Type

Java has a fixed set of primitive types: boolean, byte, short, int, long, char, float, and double. They can also be used in a wrapper class in order to enhance the functionalities....
Java Conceptuel Diagram
Java - API - Class Library

Classes, interfaces, constructors, members, and serialized forms are collectively known as API elements. A class whose implementation uses an API is a client of the API. An exported API consists of the...
Simple Class
Java - Class (Definition)

A java/lang/Classclass provides the blueprint for objects; you create an object from a class. All classes are derived from the Object class. A class declaration names the class and encloses the class...



Share this page:
Follow us:
Task Runner