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()");} }
Please enable Javascript in your browser, before you post the comment! Now Javascript is disabled.
Your name/nickname
Your email
WebSite
Subject
(Maximum characters: 1200). You have 1200 characters left.