GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Oracle  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 131 of 134    Print  
public class A {

int x;

public static void main(String args[]) {

x=x+1;
s.o.p(x);
}
}

what is the output?
a) compile time error
b) runtime error

  
Total Answers and Comments: 4 Last Update: August 14, 2007     Asked by: S.N.Prasath 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 31, 2006 01:31:36   #1  
Jay Prakash Dutta        

RE: public class A {int x; pub...

This program output is -Compile time error..Because int i is non-static variable.we cann't call non-static variable within static method.


 
Is this answer useful? Yes | No
August 31, 2006 01:43:06   #2  
bjayprakash Member Since: August 2006   Contribution: 1    

RE: public class A {int x; pub...
This program output is compile time error. Because int i is non-static variable .we cann't access non-static variable within a static method.

 
Is this answer useful? Yes | No
December 28, 2006 06:46:13   #3  
tapani        

RE: public class A {int x; pub...
compile time error
 
Is this answer useful? Yes | No
August 14, 2007 04:37:44   #4  
satyanarayana        

RE: public class A {int x; pub...
Compile time error
In that program int x is an nonstatic variable we can't call directly with static method

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape