// 정수 세개를 입력받아 else if로 비교후 가장 큰 수 하나만 출력
class ElseIfEx2
{
public static void main(String[] args)
{
int a = Integer.parseInt( args[0] );
int b = Integer.parseInt( args[1] );
int c = Integer.parseInt( args[2] );
if ( a > b && a > c ) System.out.println( "큰 수 : " + a );
else if ( b > c ) System.out.println( "큰 수 : " + b );
else System.out.println( "큰 수 : " + c );
}
}
알고보면 매우 간단하고 쉬운...
'매니저 > JAVA1' 카테고리의 다른 글
JAVA1 switch 예제2 (0) | 2011.12.08 |
---|---|
JAVA1 switch 예제1 (0) | 2011.12.08 |
JAVA1 fi ~ else 예제1 (0) | 2011.12.08 |
JAVA1 if 예제2 (0) | 2011.12.08 |
JAVA1 if 예제1 (0) | 2011.12.08 |