ShouhinTest4.java



public class ShouhinTest4 {

    public static Shouhin[] zaiko = {
                       new Shokuryouhin( "牛乳", 198, "1/23 15:00" ),
                       new Nitiyouhin( "シャンプー", 500, "Japan" ),
                       new Nitiyouhin( "タオル", 220, "China" ),
                       new Shokuryouhin( "トマト", 58, "1/30 18:00" ),
                       new Shokuryouhin( "麦茶", 148, "3/31 23:00" ),
                     };

    public static void _________( Shouhin[] s ) {

        System.out.println( "=== 食料品リスト ===" );
        for( ____________________________  ) {

            if( s[i] instanceof Shokuryouhin ) {
                System.out.println( s[i].toString() );
            }
        }

        System.out.println( "=== 日用品リスト ===" );
        for( ____________________________  ) {

            if( s[i] instanceof Nitiyouhin ) {
                System.out.println( s[i].toString() );
            }
        }
    }

    public static void main( String[] argv ) {

        _________( zaiko );
    }
}