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 |
Tags
- 스프링
- 코틀린
- Android
- java
- HTML
- 배포
- javascript
- 판다스
- streamlit
- 파이썬
- pandas
- 시간
- mlb stats api
- kotlin
- 프로젝트
- 오라클
- 어플
- 기록
- 안드로이드
- CSS
- 제이쿼리
- MLB
- Spring
- Python
- 앱
- 자바스크립트
- JQuery
- oracle
- 자바
- gcp
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