Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes 1.4 certification objectives Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "1.4 certification objectives" Watch "1.4 certification objectives" New topic

1.4 certification objectives

Matthias Wendel

Joined: Sep 26, 2007
Posts: 10
In a 1.4 mock exam I found:

What will the output of the following program:

Can anyone tell me to wich (1.4)Certification objective this question refers?
marc weber

Joined: Aug 31, 2004
Posts: 11343

These unnamed blocks are initializer blocks, which I think fall under "Language Fundamentals."

If the block has a "static" modifier, it will execute when the class is loaded. Otherwise, without a "static" modifier, the block will execute when an instance is initialized (before the body of the constructor).

I've modified the code to demonstrate this. Note that when an instance is created, the non-static initializer block executes before the constructor body. Also note that the static block only executes once, when the class is loaded (which happens when the static main method is invoked). So creating a second instance does not cause the static block to execute again.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Bert Bates

Joined: Oct 14, 2002
Posts: 8803
What's interesting is that init blocks are on the 5.0 exam but they're NOT on the 1.4 exam!

Anyway, I would strongly recommend that you study for the 5.0 exam, not the 1.4.

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Matthias Wendel

Joined: Sep 26, 2007
Posts: 10
It's because I'm under pressure what concerns my resources of preparation time. And everybody is saying the 5.0 exam is more difficult. What are the main arguments to do the 5.0 exam?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

The current version of Java is version 6, and it has been out for almost a year already. So with Java 1.4 you are two releases behind the current version.

In Java 5, a whole list of new language features have been added. More and more Java projects are being done with Java 5 or Java 6, and if you're going to work on such a project you'll be expected to know those new features.

So an SCJP 5 certificate is worth more and will last longer because it's more current.

Suppose you're on a job interview and you're asked "Why did you do SCJP 1.4 instead of SCJP 5?". Are you then going to answer "Because it is easier"? That wouldn't leave a good impression...
[ November 08, 2007: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Matthias Wendel

Joined: Sep 26, 2007
Posts: 10
Thank you - I'll think it over.
I agree. Here's the link:
subject: 1.4 certification objectives
Similar Threads
inner class
Please help me