Local variabeles in java

Posted by Mandar on Stack Overflow See other posts from Stack Overflow or by Mandar
Published on 2010-05-16T15:55:42Z Indexed on 2010/05/16 16:00 UTC
Read the original article Hit count: 401

Hello ,
I went through local variables and class variables concept.

But I had stuck at a doubt
" Why is it so that we cannot declare local variables as static " ?

For e.g
Suppose we have a play( ) function :

void play( )
{
static int i=5;
System.out.println(i);
}

It gives me error in eclipse : Illegal modifier for parameter i;

Thanks.

© Stack Overflow or respective owner

Related posts about local-variables

Related posts about variables