package com.study.javastudy.study;

public class ConstantExam {
    public static void main(String[] args) {
        int i;
        i = 10;
        i = 5;

        final int J; //상수 앞에는 final, 상수는 대문자 사용
        J = 10;

        //J = 5; //상수는 값을 한번 넣을 수 있다


        double circleArea;
        final double PI = 3.14159;
        circleArea = 3 * 3 * PI;

        final int OIL_PRICE = 1450;

        int totalPrice = 50 * OIL_PRICE;
    }
}

'자바 기초' 카테고리의 다른 글

비교연산자  (0) 2024.01.26
연산자와 연산  (0) 2024.01.26
기본형 데이터 타입 변환  (0) 2024.01.26
기본형 데이터 타입  (0) 2024.01.26
변수  (2) 2024.01.26

+ Recent posts