File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question

 
Soum Sark
Ranch Hand
Posts: 50
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
{} denotes an instance initialization block. Please refer to JLS 8.6 Instance Initializers for detailed information.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic