Current post type: post
int
, float
, String
).int
, double
, char
, boolean
.class
, enum
, interface
, record
.Stack
, Queue
, List
).push()
, pop()
, insert()
, delete()
).β Every Data Structure is a Data Type, but Not Every Data Type is a Data Structure.
Stack
, Queue
, Tree
β Both Data Structure & Data Type β
int
, double
, boolean
β Data Type but NOT a Data Structure β// Primitive Data Type (Not a Data Structure)
int x = 10; // Just a value, no structure
// User-Defined Data Type (Also a Data Structure)
class Stack {
private int[] arr = new int[10];
private int top = -1;
void push(int value) { arr[++top] = value; }
int pop() { return arr[top--]; }
}
β
Stack
is both a Data Structure and a User-Defined Data Type.
Β© 2025 My Company