Welcome Guest | Sign in | Register
Static Concept - Discussion Page For Q.2936 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Static Concept > Questions and Answers

Exercise:

Section 1

Q: class G{
Int I;
}

Class Manager{
Public static void main(String args[]){
System.out.println(G.i);
}
}
A. compile time error B. 0 and runtime error
C. runtime error D. no output

Answer and Explanation

Answer:compile time error

Explanation:
here variable I is non-static ,this variable can not be accessed from static function main(), if you try it will throw an compile time error.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.