Section 2: Non-primitive data types in Java

In the last section, we learn what are the primitive data types in java. In this section, we will know which are non-primitive data types in java.

Before moving further following table is a summary of primitive data types.

Non-Primitive data types:
These are also called reference types since they referred to an object. The default value for non-primitive data types can be set as null because of the object reference property.

Classes:

Classes are considered user-defined data types. In class, we can have different methods and variables. To refer to these variables and be can create a reference of a class called an object.

Arrays:

In the arrays, we can store multiple values having the same data type in consecutive format. Users can store any type of data into an array and size can be also declared by the user.

Interface:

The interface is a class that only has methods defined inside it. Implementation can be added in its implementing child class. From Java 8 onwards we can have static and default methods inside the interface having their own declared code.

Since we know about which data types are supported by java. We can see which are the wrapper classes implemented by java to support primitive data types.

Wrapper Class:

To convert primitive data types into objects we require a wrapper class.
Following is the table for primitive data types and their corresponding wrapper class.

-A blog by Shwetali Khambe

Related Posts