|
Average Rating: 1.5/5 | Rate this item | 25 users have rated this item.
|
Expertise: Beginner
Language: Java
October 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
If you have a hot tip and we publish it, we'll pay you. However, due to accounting overhead we no longer pay $10 for a single tip submission. You must accumulate 10 acceptable tips to receive payment. Be sure to include a clear explanation of what the technique does and why it's useful. If it includes code, limit it to 20 lines if possible. Submit your tip here.
|