🟢 Foundation  ·  Lesson 06

Data Types in Java

Data Types in Java

Two Categories

Java data types are primitive (basic values) and non-primitive (objects like String and arrays).

Primitive Types

TypeStoresExample
intwhole numbersint x = 10;
doubledecimalsdouble p = 9.5;
charsingle characterchar g = 'A';
booleantrue/falseboolean ok = true;
longbig whole numberslong n = 100000L;

Non-Primitive Types

String, arrays, and classes. These store references to objects, not the value directly.

String city = "Delhi";
int[] marks = {88, 92, 79};

Summary

  • Primitive: int, double, char, boolean, long, etc.
  • Non-primitive: String, arrays, objects.

दो श्रेणियाँ

Java data types primitive (basic values) और non-primitive (String, arrays जैसे objects) होते हैं।

Primitive Types

Typeरखता हैExample
intपूर्ण संख्याint x = 10;
doubledecimalsdouble p = 9.5;
charएक characterchar g = 'A';
booleantrue/falseboolean ok = true;
longबड़ी पूर्ण संख्याlong n = 100000L;

Non-Primitive Types

String, arrays, और classes। ये value सीधे नहीं, objects के references रखते हैं।

String city = "Delhi";
int[] marks = {88, 92, 79};

सारांश

  • Primitive: int, double, char, boolean, long आदि।
  • Non-primitive: String, arrays, objects।
← Back to Java Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

\n