¿¹Á¦

public static void main( String[] args ) {
if ( args.length > 3 ) {
System.out.println( "More than 3" ); //$NON-NLS-1$
if ( args[ 0 ].startsWith( "a" ) ) { //$NON-NLS-1$
System.out.println( "Starts with a" ); //$NON-NLS-1$
if ( args[ 1 ].endsWith( "z" ) ) { //$NON-NLS-1$
System.out.println( "Ends with z"); //$NON-NLS-1$
}
}
}
}

¼Ö·ç¼Ç
Á¶°ÇÀÇ ¾ÕµÚ¸¦ ¹Ù²Ù°í return ¹®À» Ãß°¡ÇϽʽÿÀ.
Martin Fowler´Â ¸®ÆÑÅ丵¿¡¼­ ´ÙÀ½ ¼Ö·ç¼Ç¿¡ ´ëÇØ ¼³¸íÇÕ´Ï´Ù.
  1. °¡Àå ¹Û¿¡ ÀÖ´Â if ¹® Á¶°ÇÀÇ ¾ÕµÚ¸¦ ¹Ù²Ù½Ê½Ã¿À.
  2. if ¹® ¾Æ·¡¿¡ return ¹®À» Ãß°¡ÇϽʽÿÀ.
  3. ´õ ÀÌ»ó ÁßøµÈ if ¹®ÀÌ ¾øÀ» ¶§±îÁö ÀÌ·¯ÇÑ ´Ü°è¸¦ ¹Ýº¹ÇϽʽÿÀ.

public static void main( String[] args ) {
if ( args.length <= 3 ) {
return ;
}

System.out.println( "More than 3" ); //$NON-NLS-1$

if ( !args[ 0 ].startsWith( "a" ) ) { //$NON-NLS-1$
return ;
}

System.out.println( "Starts with a" ); //$NON-NLS-1$

if ( args[ 1 ].endsWith( "z" ) ) { //$NON-NLS-1$
System.out.println( "Ends with z" ); //$NON-NLS-1$
}

}