Non Primitive Data Type in Java

Hin

In previous article, we have learned the primitive data types. Now, Let's move one step ahead and learn another kind of data types that is known as non-primitive data types.

Non-primitive data types are not predefined, they are created as per need by the programmers and its size and type is depends on requirements.
Class, Object, String, Array and Interface are the primitive data types and also known as reference type because they refer to the objects. Basically Actually non-primitive variables are references which refers to the heap memory where the object actually stored.

Program to demonstrate the String as non-primitive types.

Output:
Demo@15db9742
Tarique

Program to demonstrate the String Array and Object Array non-primitive types.

Output:
Object Array: Noida
String Array: Delhi

Program to demonstrate the wrapper class like, Integer and Float non-primitive types.

Output:
Integer value : 10
Float value : 25.8

Conclusion

In this article, we learned the non-primitive data types with detailed examples.

Tarique Anwer
AUG 18, 2024 04:45 AM
Report Error

Article helpful ?

Switch

Java
Java
Python
Python
Php
Php
Blogs
Why is a local variable not accessible outside the methods?
How did Java become a Platform Independent language ?
Why Multi-threading application's performance always appreciated?
Let's Understand the handling process of String and StringBuffer
What is Reference value and Why Java does not support Pointers?

Home

Training

Enquiry

Assessment

More