Originally posted by Krishna Tota:
Hi,
public class Test{
public int aMethod()
{
static int i=0;
i++;
return i;
}
pblic static void main(String a[])
{
Test t=new Test();
t.aMethod();
int j=t.aMethod();
System.out.println(j);
}
}
What is the rong with this code.
please explain in brief.
Thanks.
Method-local variables( those declared inside a method) can't have the modifiers
coderanch, private, protected, transient, syncronized, abstruct, strictfp, static. They can only have the modifier
final.