# core java issue:alternative for super keyword in static method



## rahulchand (Jun 12, 2010)

as you know java doesn't allow the use of super keyword inside a static method,is their any way to access the data member of super class having same name and type as that of a local data member in main method without creating an object reference.

class A
{
 static int x=10;//access to 10 without object reference
}
class B extends A
{
 public static void main(String []rc)
{
 int x=11;
System.out.println("--"+x);//prints 11
}
}


----------



## prttal (Jun 12, 2010)

You may create another non-static function like 
public int getVal()
{
//code here
}


----------



## Garbage (Jun 17, 2010)

Can't you do like 
	
	



```
System.out.println("--"+A.x);
```
?


----------

