サンプル

public static void main( String[] args ) {
emptyIf( args );
emptyLoop( args );
}

private static void emptyIf( String[] args ) {
if ( args.length == 0 ){
}else {
for ( int i = 0; i < args.length; i++ ) {
if ( i > 0 );
System.out.println( args[ i ] );
}
}
}

private static void emptyLoop( String[] args ) {
int i = 0;
while ( i < args.length );
System.out.println( args[ i++ ] );
for ( int j = 0; j < args.length; j++ ){}
}

解決策
以下のステートメントをループまたは if ステートメント内にインクルードします。


public static void main( String[] args ) {
emptyIf( args );
emptyLoop( args );
}

private static void emptyIf( String[] args ) {
if ( args.length > 0 ){
for ( int i = 0; i < args.length; i++ ) {
if ( i > 1 ) {
System.out.println( args[ i ] );
}
}
}
}

private static void emptyLoop( String[] args ) {
int i = 0;
while ( i < args.length ){
System.out.println( args[ i++ ] );
}
for ( int j = 0; j < args.length; j++ ){
System.out.println( args[ j++ ] );
}
}