Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Python
- oracle
- java
- Android
- kotlin
- 시간
- 앱
- JQuery
- 자바스크립트
- 코틀린
- 기록
- HTML
- pandas
- 자바
- 파이썬
- gcp
- 안드로이드
- CSS
- 배포
- mlb stats api
- streamlit
- Spring
- 프로젝트
- MLB
- 스프링
- 오라클
- javascript
- 어플
- 판다스
- 제이쿼리
Archives
- Today
- Total
develope_kkyu
[JAVA] 스캐너 본문
728x90
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); // 키보드로부터 입력받겠다.
int age;
System.out.print("당신의 나이를 입력하세요.");
age = sc.nextInt(); //정수만 받음
System.out.printf("당신의 나이는 %d세입니다. \n", age);
sc.nextLine(); // 강제로 찌꺼기 소화.
System.out.print("당신의 이름은? ==>");
String name;
name = sc.nextLine(); //문자형으로 받음
System.out.printf("당신의 이름은 %s입니다.\n", name);
System.out.print("오늘의 온도는? ==>");
double temperature;
temperature = sc.nextDouble();
System.out.printf("오늘의 온도는 %4.1f도 입니다.\n", temperature);
sc.close();
}
728x90