문서의 이전 판입니다!
package chapter05;
public class IfEx {
public static void main(String[] args) {
int score = 70;
System.out.println("시험 시작");
if (score >= 60) {
System.out.println("합격입니다.");
}
System.out.println("시험 끝");
}
}
package chapter05;
public class IfEx1 {
public static void main(String[] args) {
int score = 50;
System.out.println("시험 시작");
if (score >= 60) {
System.out.println("합격입니다.");
} else {
System.out.println("불합격입니다.");
}
System.out.println("시험 끝");
}
}
package chapter05;
public class IfEx2 {
public static void main(String[] args) {
int score = 80;
String grade = "";
System.out.println("학점부여 시작");
if (score >= 95) {
grade = "A+";
} else if (score >= 90){
grade = "A";
} else if (score >= 85) {
grade = "B+";
} else if (score >= 80) {
grade = "B";
} else if (score >= 70) {
grade = "C";
} else if (score >= 60) {
grade = "D";
} else {
grade = "F";
}
System.out.println("당신의 학점은 "+grade+"입니다.");
System.out.println("학점부여 끝");
}
} </code>
별도로 명시하지 않을 경우, 이 위키의 내용은 다음 라이선스에 따라 사용할 수 있습니다: CC Attribution-Share Alike 4.0 International