inblog logo
|
An's Blog
    JAVA

    [JAVA] 2. 변수의 자료형

    윤설안's avatar
    윤설안
    Feb 03, 2025
    [JAVA] 2. 변수의 자료형
    Contents
    결과
    💡
    변수의 Type이 존재하는 이유!!
    • 메모리 공간을 낭비하지 않기 위해서
    notion image
     
    public class Var01 { // 1. 클래스 이름 (오브젝트) public static void main(String[] args) { // 2. 메서드 (행위) 3. main (메서드 이름) int n1 = 10; // 정수 double n2 = 10.5; // 실수 boolean n3 = true; // false (참거짓) char n4 = 'A'; // 문자 System.out.println(n1); // 모니터에 ByteStream을 연결해서 괄호 안에 값을 출력 System.out.println(n2); System.out.println(n3); System.out.println(n4); } }

    결과

    notion image
    Share article
    Contents
    결과

    An's Blog

    RSS·Powered by Inblog