A programmer's tale

Tuesday, July 31, 2007

making class final in fantastic way! - java.lang.Math revisited

Utility classes should be final. Utility classes generally contains static constants and static utility methods .It should not be instantiated nor it should be inherited.
Now how to make this class final and make it non instantiating? Simple question. And the answer is also as simple as the question. Declare the class with final keyword make the constructor private like the Math class in java.lang.Math.
But here the final is redundant, no need to declare the class with final, if the constructor of a class is private, then the class is implicitly final. No need to declare it with the final keyword. Look at the following code:

public class FooUtils {

private FooUtils() { }

}

Here FooUtils is our util class. If we sunclass it as:

public class Bar extends FooUtils {
}


we will get compilation error. Hence no need of final keyword. For the same reason the final keyword in java.lang.Math class in redundant.

Sunday, July 29, 2007

My SCJP 1.5 Experiences

After two months solid preparation, I completed my SCJP 1.5(CX-310-055) on July 21, 2007. I finished up with 90%; answered 65 questions correctly out of 72 questions.

I’ve been programming in Java for around two years. But without the preparation I couldn’t able to enter the deeper corner of J2SE, this preparation not only increase my Java knowledge but also sharpen my skills in Java. With your daily Java works in office it’s not always needed to know some of the most subtleties and sophisticated techniques in Java. But when you prepare for the SCJP, it is more likely that you will learn some very uncommon and usually overlooked Java techniques. For this I really enjoyed the preparation phase.

How I prepared?

I read the SCJP 1.5 book by Katherine Sierra and Bert Bates thoroughly and rigorously. It is best book for SCJP I think. I took every SELF-TEST in this book with a paper and pencil and when the answer went wrong, I took the note in a separate place that became my tips and tricks for the final exam. These tips definitely vary from person to person depending upon their Java knowledge and experiences. So it is always better to prepare this for every individual. CD contents of this book are very useful for preparation. It contains the entire book in PDF format and a mock exam that they call master exam. Take this master exam only after you finished your preparation. You can download one bonus exam from the book site with the CD in your CD-ROM. Don’t take this exam in earlier stage of your preparation.

I also follow the book by Philip Heller, but I took only the exams and SELF-TEST in this book. It is also good book.

I took the help of many successful SCJP candidates all over the world in many SCJP forums and communities. It was really a great help. I took nearly every mock test I encountered online. The javaranch SCJP mock test repository is very good resource for online SCJP mock tests. Take a look at the SCJP FAQ section in javaranch also. All these and many other resources are tagged here.

During my preparation I also took the exams from javablackbelt you can see my status here. My advice is took the exam with paper and pencil and make your own trips and trick repository.

I purchased the exam voucher about 2 and ½ months ago. Some offer was going on and I purchased it by 5,000 INR, but the validity of my voucher was up to 31st August, 2007. The one year validity voucher was 150 USD that time as I saw in Sun site. But it is now 200 USD i.e. more than Rs. 8,000. I am lucky, na!! ;)

Experiences during exam:

You are not allowed to bring any paper or pencil inside the exam room. You will be provided with a small white board or plastic writing pad with a marker pen. You have to make any calculation on that, you may be provided with extra pad if you need that.

Every information about the question types and duration can be available in Sun certification site. But during exam you may face a little problem for the question type. Some questions show you “task” button, you have to click it to see the actual content of the question and after answering you press the “Done” button in the new child window. For some questions you have to press the “Exhibit” button in the lower portion of the main window. It will bring a child window with the question contents. After seeing the question, you “close” the window and select the correct answer. You can mark a particular question for further review during the exam, but before pressing the “End” button remember to remove all the marks in your marked questions.

If you are well prepared, it will be not very difficult to pass the exam, but if you want to score above 85% or 90%, it may be very tricky and tough. The questions appears in the exams are very balanced, they are from beginner level to expert level. So some questions may take time and some are easy to answer in few seconds. Always expect some surprise i.e. some innovative and new types of questions you have never encountered before. But hopefully the number of this type of question is small. That’s good as far as you are well prepared. Don’t make any hurry during the exam, the time is not at all a problem; rather concentrate to your question with reasoning. Look for the syntax and semantic very carefully because many question results in compilation errors. If the answer includes “compilation error” option, then look for compilation error very carefully and then after ensuring it you try to understand which Java concept the question is asking. This can minimize you time and increase accuracy. If you have any confusion and queries you can reply to this post. I will try to clarify that.

Post certification Task:
You can use Sun certified programmer brand logo in your resume for your marketing after completing the exam. I have got my logo. That's look good, na!