Today I learned Java data-types
SEENUVASAN P

SEENUVASAN P @seenuvasan_p

Joined:
May 27, 2025

Today I learned Java data-types

Publish Date: Jul 14
1 0

There are two Data-types in java:

  • Primitive data type

  • Non-primitive data type.

Primitive data type:

There are six primitive data types:

these data type is inbuilt space in that data type like 1 byte and 2 byte.

  • Byte = memory capacity is 1 byte it store the numbers like 123
  • short = memory capacity is 2 byte it store the number only
  • int = memory capacity is 4 byte it store the number only
  • long = memory capacity is 8 byte it store the number only
  • float = memory capacity is 4 bytes it store the decimal numbers like 3.45
  • Double = memory capacity is 8 byte it store the decimal numbers
  • char = memory capacity is 2 byte it story only one charactor like 'A'

Non-primitive data types:

  • They are not built-in basic types like int, char, float.

  • They are made from classes.

  • They can store multiple values and have methods.

  • Also called reference types because they store a reference (memory address).

These are the data types:

  • String Stores text (many characters) "Seenu", "Java is fun"
  • Array Stores a group of value {10, 20, 30}
  • Class Blueprint for creating custom objects new Student();
  • Object Parent of all classes Object obj = new Object();
  • InterfaceCollection of abstract methods interface Animal {}

Comments 0 total

    Add comment