Estamos reforzando la seguridad del sitio. Es posible que algunas funciones no estén disponibles temporalmente. Gracias por su comprensión.
 

Java Data Types Decoded: Master the Language of Data!

30Min
1,200 P
Zoom icon Lattep icon
Discover how Java stores and handles data! Learn the difference between int, float, double, char, boolean, and more through simple examples and hands-on coding.

Detalles de la lección

In programming, integers, floats, and doubles are called data types.

They are used to represent different kinds of numerical values.

Data type

What it stores

Example in Java

int

Whole numbers without decimal points

int age = 25;

float

Decimal numbers with single precision

float price = 9.99f;

double

Decimal numbers with double precision

double pi = 3.14159265;

In simple terms

  • Integer (int): Stores whole numbers, such as 10, -5, or 100.

  • Float (float): Stores decimal numbers, such as 3.14 or 7.5. In Java, you must add f at the end of a float literal, like 3.14f.

  • Double (double): Stores decimal numbers with greater precision than float. It is the default type for decimal literals in Java.

Java example

java int age = 20; float height = 1.75f; double salary = 2500.75;

Remember: These are all primitive data types in Java. 

Other primitive data types include byte, short, long, char, and boolean.

Java Data Types: A Beginner-

Friendly Lesson 

Let's learn Java data types step by step, with simple explanations, examples, and practice exercises.

1. What are data types in Java?

A data type tells Java what kind of value a variable can store, such as a whole number, a decimal number, a character, or a true/false value.

Think of variables as boxes. Each box stores a particular kind of information, and the data type tells Java what kind of information belongs in that box.

 

int age = 20;

A box for a whole number.

 

double price = 19.99;

A box for a decimal number.

 

char grade = 'A';

A box for one character.

2. The two main categories of Java data types

Java data types are commonly divided into two categories.

A. Primitive data types

These are Java's eight built-in data types. They store simple values directly.

Type

Stores

Example

byte

Small whole numbers

byte n = 100;

short

Short whole numbers

short n = 1000;

int

Whole numbers

int n = 25;

long

Large whole numbers

long n = 900000L;

float

Decimal numbers

float n = 3.5f;

double

More precise decimals

double n = 3.14159;

char

One UTF-16 code unit

char c = 'A';

boolean

true or false

boolean b = true;

 

 
 

Política de cancelación del(de la) tutor/a

Antes de que la solicitud haya sido confirmada.

  • Es posible hacerlo en cualquier momento.

Luego de que la solicitud de clase haya sido confirmada

  • Más de 24 horas antes del inicio de la clase→ Es posible hacerlo en cualquier momento.
  • Menos de 24 horas antes del inicio de la clase→ Pueden aplicarse cargos por cancelación.
  • No-Show→ Pueden aplicarse cargos por cancelación.
    (La cantidad puede variar en función del tutor, por favor comuníquese con su tutor/a)

Todas las clases del (de la) tutor/a

FatimaK
from
in
1
1

Horarios disponibles  

Mon 00:30 –   01:30
Mon 02:00 –   04:00
Mon 15:00 –   20:00
Mon 20:30 – Tue 03:00
Tue 15:00 –   20:00
Tue 20:30 –   22:00
Tue 22:30 –   23:30
Wed 00:00 –   00:30
Wed 01:00 –   03:00
Wed 15:00 – Thu 03:00
Thu 15:00 –   20:00
Thu 20:30 – Fri 00:00
Fri 00:30 –   03:00
Sat 15:00 –   20:00
Sat 20:30 – Sun 03:00
Sun 16:00 –   21:00
Sun 21:30 – Mon 00:00
Actual availability may differ. Please check when you make a request.
Shown in Asia/Tokyo time.
Java Data Types Decoded: Master the Language of Data!
30Min
1,200P
Zoom icon Lattep icon

FatimaK

from
 
in
 
Got a question? Click to Chat