2011-05-31 42 views

回答

10

試試這個:

this.doop= new int[]{1,2,3,4,5}; 
+0

thankyouthankyouthankyou – animeman420 2011-05-31 06:35:10

3

你不能做到這一點在構造函數中,因爲這句法只允許申報與初始化。修復此:

class Foo{ 
    int[] doop = new int[]{1,2,3,4,5}; 

    public Foo(){ 

    } 
} 
3
class Foo{ 
    int[] doop; 

    public Foo(){ 
      this.doop= new int[]{1,2,3,4,5}; 
    } 
}