Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Beginner
Oct 26, 2009

Static Class Values Are Valid Even Without a Main Method

Static fields have class-level scope, so they can execute even without a main() method. Here's an example:

public class Static
{
     static{System.out.println("I will print without main()");}
}
Mannu Saini
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap