Hey all,
Given below code...
package Test1;
public class superma {
protected int g=9;
}
package Set2;
import Test1.superma;
public class Q37 extends superma {
//int g=12; //Global scope
public static void main(
String args[])
{
//int g=12; //Local scope
Q37 a= new Q37();
//superma m= new superma();
System.out.println(a.g);
}
private void fogo(){}
}
If the variable g is declared in Q37 as local variable it prints the value of superma.g i.e 9 but when its is declared as global variable it prints 12.Please explain
Thanks