• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

1.4 certification objectives

 
Matthias Wendel
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Regards,
Matthias
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Matthias Wendel
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Regards,
Matthias
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Matthias Wendel
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you - I'll think it over.
Regards,
Matthias
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic