The JDK 1.5 SCJP Exam The Sun Certified Java Programmer Exam for JDK 1.5 is one of the more significant updates to the exam syllabus. You can see the objectives of the new exam at
http://www.sun.com/training/catalog/courses/CX-310-055.xml It makes sense that this is a big update as JDK 1.5 introduced some significant changes to the Java language. There has been considerable discussion in the SCJP forums along the lines of "should I take the 1.4 or the 1.5 exams" and some people have taken the line that there is a shortage of exam specific material for the 1.5 exam and the exam is more difficult. The exam may be slightly harder than the 1.4 exam, but that should be an incentive as a difficult exam can gather more respect than an easier exam. Either way, although it is not trivial it isn't rocket science either and good study material is starting to become available. One of the co-authors of the exam, Bert Bates had this to say about the new exam:
One of the main goals of this new exam is to create a test that is "performance based" rather than "knowledge based" (Sun's terms). Generally what this means is that a "knowledge based" question tends towards memorization of details, and a "performance based" question tends towards more real world activities like actually writing code. One of the ways in which the new exam is performance based is the introduction of "drag and drop" questions. You are given some Java code with gaps and you have to drag from a list of options to complete the code. Be warned however that once you move off a drag-and-drop question if you go back to it your selections are not represented, which can be disconcerting. The new exam drops the "fill in the blank space" type question that worried many people on previous exams.
Although there is significant overlap with the JDK 1.4 exam I guess that there is at least 30% new material to learn. Some of the new topics are
regular expressions the Locale class the Text class serializing streams generic collections generic method parameters input/output classes for-each looping locales (dates and currencies) enums autoboxing OO concepts (coupling and cohesion) jar files sorting and searching collections covariant returns JavaBean naming varargs In my view these are all valid new additions to the exam as they cover subjects that you are likely to need in real world Java programming. As there is so much material I can only touch on some topics in this article. I was delighted to see that the new exam does not cover the bit shifting operators that were covered in the JDK 1.4 exam. It is possible to spend years as a Java programmer without ever having to deliberately shift a bit.
Regular expressions The exam now covers the Java regular expression operators that were introduced with JDK 1.4. Fortunately there are limitations on what you have to know as the exam topic specifies what operators will be tested and also says "The use of *, +, and ? will be limited to greedy quantifiers, and the parenthesis operator will only be used as a grouping mechanism, not for capturing content during matching". If you have ever done regular expressions in another language such as Perl you will have a head start with Java regular expressions. You can read about Java Regular expressions at http://java.sun.com/docs/books/tutorial/extra/regex/
Generics address two issues with the collection classes. One is that as a programmer you have to remember to write the rather pointless code that casts back from Object to whatever the type of reference is. You will probably have seen code where you have an instance of a Collection such as a Vector called v that contains strings and a loop is retrieving each element thus
String s = (String) v.get(0); With generic collections you don't have to cast back to the original type, because the instance of the collection knows the type of its elements.
Perhaps more importantly, using generic collections i moves some errors back from runtime to compile time. Personally I would much prefer errors to show up at compile time than months after a product has gone live and it is in the hands of real end users.
I/O This version of the exam brings the reintroduction of Input/Output classes. I was surprised when this was dropped from the syllabus for the JDK 1.4 version of the exam and you may find web based resources aimed at the JDK 1.3 version of the exam to be useful in this area. An interesting new addition is serialization, a relatively small topic but one with very wide applicability.
The for-each loop The introduction of the for-each loop is a delightful "syntactic sugar" to the language. Anyone familiar with PHP or Perl will have missed this feature. Instead of having to obtain an Iterator object and use the next method you can create a single line construct for moving through all of the elements of a collection. This is explained by Sun at http://java.sun.com/j2se/1.5.0/docs/guide/language/foreach.html.
Enums Enums are a compact and neat new feature for the language that allow the creation of named constants with their own name space. For example you could create an enum for days of the week as Mon,Tue ...Sun. Wherever you were expecting a DayOfWeek enum, it would have to be something that represented one of the days. Unlike with integer constants it would not be possible to assign some other arbitrary numerical value. Enums are appropriate where you have a known and fairly limited set of values. Read more about enums at http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html.
How to study Get a good book that explicitly covers the exam. There are now several available, and you will find them mentioned in the SCJP forum at JavaRanch. Take a look at my Frequently asked Questions List which has been updated to cover the JDK 1.5 exam. http://www.examulator.com/moodle/mod/resource/view.php?id=169 Read the exam objectives carefully, make sure you cover them all. Write large numbers of small programs that cover each topic. By small programs I mean less than 50 lines of code. Test yourself against mock exam questions but make sure they are questions aimed at the JDK 1.5 topics. Contribute to the JavaRanch forums. We like to say there are no stupid questions at JavaRanch but there are some badly asked questions. A well asked question includes you telling us what you currently understand, or more importantly what you think you understand. There are some very experienced and knowledgeable people who are keen to help/show off their knowledge and they are just a web page away.