I would like to go in detail on this.

Firstly Java is a strongly typed language i.e. before using any data we need to tell the complier of what data type this data will be.

In simple words we need to declare the data type of the variable.

Basically there are three type of data types:

  1. Primitive data types
  2. Derived data types
  3. User defined data types

Primitive data types are the general and fundamental data types that we have in Java and those are byte, short, int, long, float, double, char, boolean.

Derived data types are those that are made by using any other data type for example, arrays.

User defined data types are those that user / programmer himself defines. For example, classes, interfaces.

In very-very simple words I can say,

int a

Here a is a variable of int data type.

MyClass obj

Here obj is a variable of data type MyClass and we call them reference variables as they can be used to store the reference to the object of that class.

Answer from gprathour on Stack Overflow
Top answer
1 of 4
3

I would like to go in detail on this.

Firstly Java is a strongly typed language i.e. before using any data we need to tell the complier of what data type this data will be.

In simple words we need to declare the data type of the variable.

Basically there are three type of data types:

  1. Primitive data types
  2. Derived data types
  3. User defined data types

Primitive data types are the general and fundamental data types that we have in Java and those are byte, short, int, long, float, double, char, boolean.

Derived data types are those that are made by using any other data type for example, arrays.

User defined data types are those that user / programmer himself defines. For example, classes, interfaces.

In very-very simple words I can say,

int a

Here a is a variable of int data type.

MyClass obj

Here obj is a variable of data type MyClass and we call them reference variables as they can be used to store the reference to the object of that class.

2 of 4
1

In JAVA there are two types of data types are available, they are

   1. Primitive datatypes

   2. User Defined datatype

Basically, the primitive data types are predefined. like int, char, float, etc. if you want to store the data of types integer, character, then you can use these predefined datatypes happily. what if, if you want to store the data of your own type like Student, Employee, which is basically a combination of primitive datatypes, then here we have to go with user-defined data type, for this we can use Classes in java to store data of your own

🌐
Code2night
code2night.com › Blog › MyBlog › userdefined-data-types-in-java
User-defined data types in java | Code2night.com
September 5, 2023 - In Java, you can create user-defined data types by defining your own classes. These classes allow you to encapsulate data and behavior into custom data structures.
🌐
Tutorialink
tutorialink.com › home › java › user defined data type
User Defined Data Type | JAVA | Tutorialink.com
User defined data types related variables allows us to store multiple values either of same type or different type or both. This is a data type whose variable can hold more than one value of dissimilar type, in java it is achieved using class ...
🌐
EDUCBA
educba.com › home › software development › software development tutorials › java tutorial › data types in java
Data Types in Java
November 7, 2023 - This allows for more complex data structures and dynamic memory allocation. Objects created from reference data types have methods and attributes associated with them. In addition to these two primary classifications, it’s also worth noting: Developers can create their custom data types in Java using classes and interfaces. These user-defined data types allow for creating objects with specific attributes and behaviors, making Java a versatile and object-oriented programming language.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Tutorialspoint
tutorialspoint.com › java › java_data_structures.htm
Java - Data Structures
The Hashtable class provides a ... on some user-defined key structure. For example, in an address list hash table you could store and sort data based on a key such as ZIP code rather than on a person's name. The specific meaning of keys with regard to hash tables is totally dependent on the usage of the hash table and the data it contains. The following example shows the usage of Java Hashtable ...
🌐
Oracle
docs.oracle.com › javadb › 10.10.1.2 › devguide › cdevspecialudt.html
Programming user-defined types
Derby allows you to create user-defined types. A user-defined type is a serializable Java class whose instances are stored in columns. The class must implement the java.io.Serializable interface, and it must be declared to Derby by means of a CREATE TYPE statement.
🌐
DocStore
docstore.mik.ua › orelly › java-ent › jenut › ch10_07.htm
User-Defined Data Types (Java Enterprise in a Nutshell)
In addition to the basic data types already described, IDL supports user-defined data types, which are aggregations of these basic types. These complex data types include arrays, sequences, enumerations, and constructed data types you define yourself using structs and unions.
🌐
Eskimo
eskimo.com › ~scs › cclass › int › sx1.html
Chapter 15: User-Defined Data Structures
There's an old joke about Henry Ford saying that you could get the Model T in any color you wanted, as long as it was black. User-defined data types have a little bit of the same restriction: you don't have ultimate flexibility; you can define your own data types any way you want, as long as they're collections of other types.
Find elsewhere
🌐
Thekramms
geek.thekramms.com › Oreilly › books › javaenterprise › jenut › ch10_07.htm
User-Defined Data Types (Java Enterprise in a Nutshell)
Each data member is specified using a type specification and an identifier that references the member (similar to attributes on an interface, described in Section 10.10.1, "Attributes" in Section 10.10, "Interface Declarations"). You can use basic data types, arrays, sequences, and any other typedefs as types for members of a struct. You can declare a recursive structure (a structure that includes members of its own type) by using a sequence declaration: // IDL struct LispStringList { string car; sequence<LispStringList> cdr; }; An IDL struct is mapped to a public final Java class with the same name as the struct.
🌐
Javatpoint
javatpoint.com › data-structures-in-java
Data Structures in Java - Javatpoint
September 7, 2023 - User-Defined Packages in Java · Valid variants of main() in Java · What is a Reference Variable in Java · What is an Instance in Java · What is Retrieval Operation in ArrayList Java · When to Use the Static Method in Java · XOR Operations in Java · 7th Sep - Array Declaration in Java · 7th Sep - Bad Operand Types Error in Java · 7th Sep - Data Structures in Java ·
🌐
Oracle
docs.oracle.com › cd › A87860_01 › doc › server.817 › a76965 › c11ordb.htm
User-Defined Datatypes
OCI developers can use the object type translator to generate the C datatypes corresponding to a Oracle object types. The Oracle type translator (OTT) is a program that automatically generates C language structure declarations corresponding to object types. OTT facilitates using the Pro*C precompiler and the OCI server access package. Java Publisher (JPublisher) is a program that automatically generates Java class definitions corresponding to user-defined types in the database.
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › dsa-in-java
DSA in JAVA - GeeksforGeeks
October 8, 2025 - This beginner-friendly guide covers ... ArrayList, HashMap, HashSet, and user-defined structures such as linked lists, stacks, queues, trees, heaps, and graphs....
🌐
Princeton CS
introcs.cs.princeton.edu › java › 32class
3.2 Creating Data Types
Each class can define its own main() ... method in the class. In summary, to define a data type in a Java class, you need instance variables, constructors, instance methods, and a test client....
🌐
Quora
quora.com › What-is-a-user-defined-data-structure
What is a user-defined data structure? - Quora
Answer (1 of 5): This is the structure of data or a dataset defined by the user. This could vary from large complex database objects or databases themselves or simple raw data such as line level of a specific dataset. E.g let says I have a list of attendees of a movie, each person has a name, age...
🌐
YouTube
youtube.com › watch
Data Structures - User Defined Data Types - YouTube
https://access2learn.com/tutorial/data-structures/user-defined-data-types/In this video we look at how we can create a user defined data type (or structure)....
Published: January 30, 2022
🌐
Javatpoint
javatpoint.com › data-structure-tutorial
Data Structures Tutorial
Structure A structure is a composite data type that defines a grouped list of variables that are to be placed under one name in a block of memory. It allows different variables to be accessed by using a single pointer to the structure. Syntax struct structure_name { ... ... We are excited to ...
🌐
Intellipaat
intellipaat.com › home › blog › data structures in java: types, implementation & examples
Data Structures in Java: Types, Implementation & Examples (2025)
August 14, 2026 - Managing data is an integral part of building and maintaining any kind of application or system. Data structures and algorithms in Java provide a clean way for developers to store, access, and manipulate data efficiently. They are implemented through both built-in types and custom user-defined structures, allowing extensive flexibility to developers.