목록Java (21)
IT 언어 실제
// 사다리꼴의 넓이 구하기 import java.util.Scanner; class Day03_2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int widthTop; // 윗변 int widthLow; // 아랫변 int height; // 높이 System.out.println("\t" + "[사다리꼴 넓이 구하는 공식]"); System.out.println("\t" + "사다리꼴의 가로와 세로의 길이를 입력하세요"); System.out.println("\t" + "=========================================="); System.out.print("\t" + "윗..
// 사각형의 둘레, 넓이 구하기 import java.util.Scanner; class Day03_1 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int width; // 가로 int height; // 세로 System.out.println("\t" + "[사각형 둘레와 넓이 구하는 공식]"); System.out.println("\t" + "사각형의 가로와 세로의 길이를 입력하세요"); System.out.println("\t" + "========================================"); System.out.print("\t" + "가로: "); width = input...
/* 이스케이프문자=특수문자(\n, \t, \r, \\, \", \' , \b, \u...등), 산술연산자(+, -, *, /, %), 대입연산자(=), 증가/감소 연산자(++, --), 비교연산자(, ==, != , instanceof), 논리연산자(&&, ||, !) 사각형의 둘레 구하기(+) 사각형의 넓이 구하기(*) 사다리꼴의 길이 구하기(+, /) 사다리꼴의 넓이 구하기(*) */ // 산술연산자(+, +, *, /, %) // 곱셈, 뺄샘, 곱하기, 나누기, 나머지 구하기 class Day03 { public static void main(String[] args) { int a = 2; int b = 5; double c = 3.14; float d = 3.4f; int candy = 500..
// 기본 데이터형 8가지 class Day02 { public static void main(String[] args) { boolean bool = true; // true 혹은 false byte bte = 127; // -128 ~ 127 까지 표현가능 short srt = -32768; short srt2 = 32767; int it = -2147483648; // -2147483648 ~ 2147483647 까지 표현가능 int it2 = 2147483647; long lo = 9223372036854775807L; // -9223372036854775808 ~ 9223372036854775807 까지 표현가능 char cr = 'j'; // 한글자만 표현가능 char cr2 = 65; // ..
class Day01 { public static void main(String[] args) { System.out.println("안녕하세요."); System.out.print("자바를 한 번 배워봅시다!"); System.out.println("오늘은 자바 1일차입니다"); System.out.print("앞으로 잘 부탁드립니다."); } } ================================================================ 출력결과 :