현재 보안 강화를 위한 작업을 진행하고 있습니다. 일부 기능을 일시적으로 이용하실 수 없는 경우가 있습니다. 이용에 불편을 드려 죄송하며, 양해 부탁드립니다.
 

Java Data Types Decoded: Master the Language of Data!

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.

레슨 상세 내용

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;

 

 
 

이 강사의 취소 방침

리퀘스트 확정 전

  • 언제든 취소 가능

리퀘스트 확정 후

  • 레슨 시작 24시간 전→ 언제든 취소 가능
  • 레슨 시작 24시간 이내→ 취소 요금이 발생할 수 있습니다.
  • 노쇼→ 취소 요금이 발생할 수 있습니다.
    (자세한 사항은 강사에게 문의해 주시기 바랍니다.)

이 강사의 다른 레슨

FatimaK
from
in
1
1

레슨 시간대  

월 00:30 –   01:30
월 02:00 –   04:00
월 15:00 –   20:00
월 20:30 – 화 03:00
화 15:00 –   20:00
화 20:30 –   22:00
화 22:30 –   23:30
수 00:00 –   00:30
수 01:00 –   03:00
수 15:00 – 목 03:00
목 15:00 –   20:00
목 20:30 – 금 00:00
금 00:30 –   03:00
토 15:00 –   20:00
토 20:30 – 일 03:00
일 16:00 –   21:00
일 21:30 – 월 00:00
실제 레슨시간은 다를 수 있습니다. 리퀘스트시 강사의 스케줄을 다시한번 확인해 주시기 바랍니다.
※ Asia/Tokyo 시간으로 표시됩니다.
Java Data Types Decoded: Master the Language of Data!
30분
1,200P
Zoom icon Lattep icon

FatimaK

from
 
in
 
부담없이 질문해 주세요!