1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | /* * Scanner 클래스를 이용하여 자료를 입력하는 작업 * */ import java.util.Scanner; public class Exam_08 { public static void main(String[] ar){ Scanner sc = new Scanner(System.in); System.out.println("자료 입력(숫자1, 문자1) "); int x = sc.nextInt(); sc.nextLine(); String y = sc.nextLine(); /* * byte => nextByte(); * short => nextShort(); * int => nextInt(); * long => nextLong(); * float => nextFloat(); * double => nextDouble(); * String => nextString(); * => nextLine(); * boolean => nextBoolean(); * */ System.out.println("x = " + x); System.out.println("y = " + y); } } | cs |
'공부 > JAVA_source' 카테고리의 다른 글
자바 선언/입력/처리 (0) | 2016.10.19 |
---|---|
자바 BufferedReader 클래스 (입력) (0) | 2016.10.19 |
자바 입출력 (2) (0) | 2016.10.19 |
자바 입출력 (1) (0) | 2016.10.19 |
자바 예외처리 (throws IOException) (0) | 2016.10.19 |