This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Why does System.out.print("1") compile when in a {} and not when outside. What purpose does the {} serve ? class Q { { System.out.print("1"); } static { System.out.print("2"); } Q() { System.out.print("3"); } }
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
posted
0
{} denotes an instance initialization block. Please refer to JLS 8.6 Instance Initializers for detailed information.