• Post Reply Bookmark Topic Watch Topic
  • New Topic

Blocks  RSS feed

 
Ramm Kummar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are confusing and intermixing two concepts -- "Initialization Blocks" (sometimes also called "Initializer Blocks") and "Blocks". There are two types of Initialization Blocks, Static Initialization Blocks and Initialization Blocks. They are used to initialize a class. Initialization Blocks cannot exist in methods because simply they cannot. Just like a constructor cannot exist inside a method. Keep in mind you can have a block of code inside a method - that is code inside a set of braces. But that is just a block, not an Initialization Blocks. Blocks are used just to "organize" code for better readability, or to limit the scope of variables. Note that there is no such thing as a "static block".

Take a look at the Java Tutorial on Initialization Blocks. You can also do a Google search on java initialization block.
 
Ramm Kummar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sachin Ramesh Tendulkar wrote:

Wow, looks who Joined the JR, A Master Blaster, Sachin Ramesh Tendulkar

We really enjoyed your century on recent 1st Test Match in New Zealand.

http://www.javaranch.com/name.jsp
 
Ramm Kummar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...It's just a start. Watch out for more tons in coming tests. Well, well, I am inside the naming rules. No worries.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So its mean, this your original name, one which appeared on your school certificates, driving license.
Then its great, hats off

[Edit: What forced you to learn Java, Is there recession in Cricket, too ]
 
Ramm Kummar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's my sports name. Anyway, Thank you. Just trying to finish SCJP as I am on benchhhhhhhhhhhhhhhhh.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!