| Author |
Can init block be declared between a couple of methods?
|
Shanu Pandey
Greenhorn
Joined: Mar 17, 2011
Posts: 18
|
|
|
Can init block be declared between a couple of methods?if yes,then how.Please Give code...
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
You're asking for a code example for that question? Really? When you could have spent 30 seconds producing an example to ask about? Come on. Show us an example. And tell us what happened when you compiled it and what your question is about that.
|
 |
Ove Lindström
Ranch Hand
Joined: Mar 10, 2008
Posts: 326
|
|
Initialization blocks can be put any place in the java code file. The compiler will sort it out.
However, the Java Coding Convention has an opinion on where to put them. Static initialization blocks first, then instance initialization blocks. After that comes the constructors and then the rest.
See http://blog.sanaulla.info/2008/05/01/initialisation-blocks-in-java/ for a good article about Initialisation blocks.
|
 |
 |
|
|
subject: Can init block be declared between a couple of methods?
|
|
|