An array declared ouside the method(at class level), and assgned values inside a method doesn't work. Why?
<p>*<em>I made an array.. at the class level,but assigned it's values inside a method.. but for some reason.. it gave up an error..
 then when i did the array declaration &amp; assignment inside of the same method..
 everything functioned smoothly!! Why is that? I declared the array at class level.. so it has class scope right?? so why can't i assign it values inside a method?? I'm utterly confused :/ *</em></p>

<pre><code>public class VacationScale{



public int [] days;

days = new int [7];


public void setVacationScale(){

    days[0]=10;
days[1]=15;
days[2]=15;
days[3]=15;
days[4]=20;
days[5]=20;
days[6]=25;

}

public void displayVacationDays(int yearsOfService){
    if(yearsOfService &gt;=0 &amp;&amp; yearsOfService&lt;=6){
    System.out.println("the years of the service of the employee is "
        +yearsOfService+ " and hence the employee is eligible to :" 
        +days[yearsOfService]+ " holidays"); 
    }
    else if(yearsOfService &gt;6){

        System.out.println("the years of the service of the employee is "
            +yearsOfService+ " and hence the employee is eligible to :25" 
        +" holidays"); 


    }
    else{
    System.out.println("invalid number of years of service");

    }

}
</code></pre>

<p>}</p>

<p><em>The error that shows up on the command prompt is--</em>  <code>identifier expected</code></p>
