*使用while循环遍历数组创建索引和自增索引值

package com.chongrui.test;

/*
 *使用while循环遍历数组
 *
 *
 * */


public class test {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
   
        String[] aves = new String[]{"白路","丹顶鹤","百灵"};//创建鸟类数组
        int index = 0;//创建索引
        System.out.println("我家花园有这种各类的鸟");
        while(index<aves.length){
            
            System.out.println(aves[index++]+" ");//自增索引值
        }
        
        
        
        
        
        
    }
    

}
======================

我家花园有这种各类的鸟
白路
丹顶鹤
百灵

 

posted @ 2017-01-01 17:34  tantanba  阅读(922)  评论(0编辑  收藏  举报