Forward Referencing in Java
Published in
Jan 19, 2024
class P006_ForwardReference
{
public static void main(String args[])
{
A a=new A();
System.out.println(a.x); // 100
}
}
class A
{
//int m=n; illegal forward reference
int n=30;
int x=getVal();
int getVal() { return 100; }
}