JAVA39 System.in.read(); package inputs; import java.io.IOException; public class SystemInRead { public static void main(String[] args) throws IOException { // System.in.read() // - 데이터 기본 반환형은 int // - 키보드 한번의 입력만 받을 수 있다.(권장x) // - 예외를 관리해줘야 한다. // - 전가(throws, 처리(개발자(나)직접 처리 : try-catch), 고의로 발생(throw) int data; System.out.println("저장할 단일문자 입력 : "); data = System.in.read(); // -> 12번째 코드에서 오류가 발생하고 있다. // 예외를 관리(전가)하.. 2022. 7. 15. println, printf, print package output; public class Output { public static void main(String[] args) { // println, printf, print // println -> 데이터 출력 후 자동개행 // print, printf -> 자동개행x // printf는 서식문자를 통한 출력이 가능하다. System.out.print("개행안됨\n"); // \n을 입력함으로서 문장에 개행을 넣어줌. System.out.printf("%.2f %s", 10.33333, "문자\n"); // 서식문자를 사용한 데이터 출력 System.out.println("개행가능"); System.out.println(); System.out.println("확인"); // 서식문자 //.. 2022. 7. 15. 주석 package exam; public class Ex2 { public static void main(String[] args) { // 주석, 코맨트 , /**/를 통해 범위주석도 가능 /* * 주석 */ /* 주석 */ /* * 프로그램 실행 - Ctrl + F11 // console 등 창이 닫겼을 경우 상단 window -> Show View 에서 다시 오픈 가능 */ // Ctrl + Shift + / == 주석처리, Ctrl + Shift + \ == 주석해제 // Ctrl + / 로도 주석이 가능하다. } } 2022. 7. 15. 이전 1 ··· 7 8 9 10 다음