Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

What is output of following code


package r4r.co.in.core.java;

public class HelloWorld {
	 static int i = 0;

	public static void main(String args[]) {
	
		System.out.println(i);
		display();
		HelloWorld h=new HelloWorld();
		h.display();
		
		
	}
      void display(){
    	 int i=0;
    	 i=90;
    	 System.out.println(i);	 
     }

}

The program will give an error : a non-static method display() can not be referenced from a static context.