1. 클래스(class)-- 클래스 생성1234567891011121314// 클래스 생성 public class Student { String name; // 객체 변수(인스턴스 멤버, 멤버 변수, 속성) public void setName(String name) { // 메소드(Method) this.name = name; } public static void main(String[] args) { Student stu1 = new Student(); // cat 객체 생성, student의 인스턴스(instance) stu1.setName("Aaron"); System.out.println(stu1.name); // 객체 변수의 값 확인 }}Colored by Color Scriptercs 2. 메..
1. if123456789if (조건문) { ...} else { ...}cs 12345678910111213if (조건문) { ...}else if (조건문) { ...} else { ... }cs 2. switch/case123456789switch(입력변수) { case 입력값1: ... break; case 입력값2: ... break; ... default: ... break;}cs 3. while12345678910while (조건문) { ... if (조건문) { continue; // 수행 문장3을 skip하고 while 조건문으로 } } Colored by Color Scriptercs 12345678while (true) { ... if (조건문) { break; // while문 빠져..
1. 숫자 (number) - 정수12int num = 10; // -2147483648 ~ 2147483647long longNum = 472964732698L; // 23372036854775808 ~ 9223372036854775807cs - 실수12double longPi = 3.14159265358979323846;float pi = 3.14F;cs - 진수12int octal = 023; // 8진수 (십진수: 19)int hex = 0xC; // 16진수 (십진수: 12)cs 2. 부울 (Boolean)12boolean isTrue = true;boolean isFalse = false;cs 3. 문자 (char) - 한 개의 문자 값1char a1 = 'a';cs 4. 문자열 (string..