java

· Java
1.클래스의 기초 객체지향 프로그래밍? 같은/유사한 형식의 반복되는 코드들 보다 반복을 줄이고, 체계적이고 안정적이게 이 버튼들을 다룰 방법ex1 public class Main { public static void main(String[] args) { Button btn1 = new Button('1',3,"dark"); Button btn2 = new Button('2',11,"dark"); Button btn3 = new Button('3',5,"dark"); btn1.palce(); } } public class Button { int space; char print; String mode; Button(char print, int space, String mode){ this.print = p..
정답코드 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a, b, r; for(int i=0 ; i
1.if / else 주어진 boolean 값에 따라 명령문 실행 여부를 결정 int score = 85; // else if : 첫 if문이 false일 때 다른 조건을 연속 사용 // else만 사용하는 것은 맨 마지막에 if (score > 90) { System.out.println('A'); } else if (score > 80) { System.out.println('B'); } else if (score > 70) { System.out.println('C'); } else if (score > 60) { System.out.println('D'); } else { System.out.println('F'); } 위 코..
· Java
1. 자료형과 연산자 1) 정수 자료형 자료형의 크기 자료형 크기 표현 범위 byte 1바이트 (8비트) -128 ~ 127 (-2^7 ~ -2^7-1) short 2바이트 -32,768 ~ 32,767 int 4바이트 -2,147,483,648 ~ 2,147,483,647 long 8바이트 -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 byte _1b_byte = 1; short _2b_short = 2; int _4b_int = 3; // ⭐️ 일반적으로 널리 사용 long _8b_long = 4; // ⚠️ 자료형의 범주 외의 수를 담을 수 없음 byte overByte2 = 128; byte overByte4 = -129; // 큰 자료형에 작은..
zero_jae
'java' 태그의 글 목록 (4 Page)