java数组

 1 public class arr{
 2     int []arr;
 3     public arr(int a) {
 4         this.arr = new int[10];
 5         for(int x= 0;x<a;x++) {
 6             arr[x]=x+2;
 7         }
 8     }
 9 
10         
11     public static void main (String []args){
12         arr1 myarr =new arr1(10);
13         for(int x:myarr.arr) {
14             
15             System.out.print(x);
16             
17         }
18         
19         
20     }
21         
22         
23     }

 

posted @ 2019-04-24 17:05  竹心_兰君  阅读(94)  评论(0编辑  收藏  举报