5.산술연산자 대입연산자

less than 1 minute read

1.산술연산자

  • 정수의 연산은 int 타입

  • 실수의 연산은 double 타입

public class OpEx01 {
	public static void main(String[] args) {

		System.out.println(10 + 3);
		System.out.println(10 - 3);
		System.out.println(10 * 3);

		// 정수 / 정수 = 정수
		// 정수 / 실수 = 실수
		// 실수 / 정수 = 실수
		System.out.println(10 / 3);
		System.out.println(10 / 3.0);
		System.out.println(10 % 3);

	}
}

2.대입연산자

Tags:

Categories:

Updated:

Leave a comment