Java doesnt allow forward references during initialization. Thats the reason the first example of firstvar doesnt work. You could get around this by calling a method. However the value of firstvar is NOT 100. Its 0 because secondvar has not been initialized at the time the method is called.

public class forward
{

// 	int firstvar = 10 * secondvar; CANT DO THIS
	int firstvar = 10 * getSecondVar();
	int secondvar = 10;
	
	int getSecondVar()
	{
		return secondvar;
	}
	

	public static void main(String a[])
	{
	
		forward f = new forward();
		System.out.println("firstvar is "+f.firstvar);
		System.out.println("secondvar is "+f.secondvar);
	}
}