• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Blocks

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's my sports name. Anyway, Thank you. Just trying to finish SCJP as I am on benchhhhhhhhhhhhhhhhh.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic