728x90
▲
결과값은 'B'
if (조건){
결과
}else if(조건){
결과
}else{
위 조건들이 아닐경우의 결과
}
▲
Scanner 객체 기능을 사용하여
입력 가능한 프로그램을 만들어보자.
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 | package ch2; import java.util.Scanner; public class Hello { public static void main(String[] args) { int score; System.out.println("점수를 입력하시오!"); Scanner sc = new Scanner(System.in); score = sc.nextInt(); if(score>=90) { System.out.println("A"); }else if(score >= 80){ System.out.println("B"); }else{ System.out.println("F"); } } } | cs |
FirstTestFirstTestFirstTestFirstTestFirstTest
AppleAndroidAppleAndroidAppleAndroAppleAndroididAppleAndroidIosJellybeanIosJellybeanIosJellybeanIosJellybeanIosJellybeanIosJellybeanFirstTestFirstTestFirstTestFirstTestFirstTest
AppleAndroidAppleAndroidAppleAndroAppleAndroididAppleAndroidIosJellybeanIosJellybeanIosJellybeanIosJellybeanIosJellybeanIosJellybeanFirstTestFirstTestFirstTestFirstTestFirstTest
AppleAndroidAppleAndroidAppleAndroAppleAndroididAppleAndroidIosJellybeanIosJellybeanIosJellybeanIosJellybeanIosJellybeanIosJellybean
300x250
'Programming > JAVA' 카테고리의 다른 글
05 JAVA SWITCH 문 DK (0) | 2018.07.27 |
---|---|
03 JAVA 첫 프로그램 'Hello World' DK (0) | 2018.07.23 |
01 JAVA의 컴파일 과정 DK (0) | 2018.07.23 |
02 JAVA 환경구축 DK (0) | 2018.07.23 |
댓글