This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Placement of static init block - Coding Conventions  RSS feed

 
Roy Pozarelli
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got the coding conventions "Java Code Conventions" September 12, 1997. What is not explicit is where to place the static initialization block. Do I place this after "Class (static) variables" and before the "Instance variables"? Or after the "Instance variables" and before "Constructors"? Just don't want to lose "stupid" points on the submission.
 
Roel De Nijs
Sheriff
Posts: 11077
173
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't use any static initialization blocks in my assignment, but I would suggest after defining the class variables. And don't forget that the order of these blocks do matter, because the order determines the execution order of these blocks when the class is loaded for the very 1st time (as you already knew of course).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!