File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Static Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Static" Watch "Static" New topic
Author

Static

Sant
Greenhorn

Joined: Jan 28, 2006
Posts: 15
Is there any possible declaring the static variable in staic method
Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Write a sample code and check the explanation given by compiler.


Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
satya mahapatra
Ranch Hand

Joined: Jan 07, 2006
Posts: 134
i think it is possible. because main is also a
static method and we can declare static variable
inside main.


Regards,<br />Satya<br />SCJP,SCWCD
John Brown
Ranch Hand

Joined: Dec 01, 2004
Posts: 35
It is not possible to declare a static variable inside any type of method because the only legal modifier for local variables is "final".
satya mahapatra
Ranch Hand

Joined: Jan 07, 2006
Posts: 134
yah john is right.it is not possilble to
declare except final anythin inside a
method not in even main method.
 
 
subject: Static