Appendix B. Preparation for Java Programming Language Certification

SUN Microsystems provides certification examinations for Solaris administrators and different types of Java programmers. Sun also offers training classes and practice exams for each type of certification.

Much of the material in this tutorial is pertinent to preparation for the examination to become a “Sun Certified Programmer for the Java Platform.”

Some useful links are:

If you open the last link and select the Testing Objectives for the Sun Certified Programmer for the Java Platform, you will find a list of objectives that includes bulleted items in seven areas:

  1. Declarations, Initialization, and Scoping

  2. Flow Control

  3. API Contents

  4. Concurrency

  5. OO Concepts

  6. Collections/Generics

  7. Fundamentals

In the text below, each of the bulleted items in each of the seven areas of the Testing Objectives for the Sun Certified Programmer for the Java Platform is quoted, followed by links to sections in this tutorial that include relevant material.

Disclaimer

This tutorial is not intended as a primer for the certification exam—it does not cover every subject to the depth that will be on the exam. The links below are presented so that you can use this tutorial as one of many sources for exam preparation.

Section 1: Declarations, Initialization and Scoping

Item 1

“Develop code that declares classes (including abstract and all forms of nested classes), interfaces, and enums, and includes the appropriate use of package and import statements (including static imports).”

  • Declaring Classes (page 87)

  • Abstract Methods and Classes (page 161)

  • Nested Classes (page 122)

  • Interfaces (page 139)

  • Enum Types (page 128)

  • Creating and Using PackagesCreating a Package (page 183)

  • import statements, static imports: Using Package Members (page 187)

Item 2

“Develop code that declares an interface. Develop code that implements or extends one or more interfaces. Develop code that declares an abstract class. Develop code that extends an abstract class.”

  • Defining an Interface (page 142)

  • Implementing an Interface (page 143)

  • Abstract Methods and Classes (page 161)

Item 3

“Develop code that declares, initializes, and uses primitives, arrays, enums, and objects as static, instance, and local variables. Also, use legal identifiers for variable names.”

  • Primitive Data Types (page 45)

  • Arrays (page 49)

  • Enum Types (page 128)

  • Understanding Instance and Class Members (page 112)

  • Variables (page 43)

  • Declaring Member Variables (page 88)

Item 4

“Develop code that declares both static and non-static methods, and—if appropriate—use method names that adhere to the JavaBeans naming standards. Also develop code that declares and uses a variable-length argument list.”

  • Understanding Instance and Class Members (page 112)

  • Passing Information to a Method or a Constructor (page 93)

Item 5

“Given a code example, determine if a method is correctly overriding or overloading another method, and identify legal return values (including covariant returns), for the method.”

  • Overriding and Hiding Methods (page 152)

  • Overloading: Defining Methods (page 90)

  • Returning a Value from a Method (page 106)

Item 6

“Given a set of classes and superclasses, develop constructors for one or more of the classes. Given a class declaration, determine if a default constructor will be created, and if so, determine the behavior of that constructor. Given a nested or non-nested class listing, write code to instantiate the class.”

  • Providing Constructors for Your Classes (page 92)

  • Using the Keyword super (page 154)

  • Creating Objects (page 99)

  • Nested Classes (page 122)

Section 2: Flow Control

Item 1

“Develop code that implements an if or switch statement; and identify legal argument types for these statements.”

  • The if-then and if-then-else Statements (page 69)

  • The switch Statement (page 71)

Item 2

“Develop code that implements all forms of loops and iterators, including the use of for, the enhanced for loop (for-each), do, while, labels, break, and continue; and explain the values taken by loop counter variables during and after loop execution.”

  • The for Statement (page 75)

  • The while and do-while Statements (page 74)

  • Branching Statements (page 77)

Item 3

“Develop code that makes use of assertions, and distinguish appropriate from inappropriate use of assertions.”

  • assertion example: Questions and Exercises: Classes (page 119)

Item 4

“Develop code that makes use of exceptions and exception handling clauses (try, catch, finally), and declares methods and overriding methods that throw exceptions.”

  • Catching and Handling Exceptions (page 236)

  • The try Block (page 238)

  • The catch Blocks (page 239)

  • The finally Block (page 240)

  • Putting It All Together (page 241)

Item 5

“Recognize the effect of an exception arising at a specified point in a code fragment. Note that the exception may be a runtime exception, a checked exception, or an error.”

  • The Catch or Specify Requirement (page 235)

  • Specifying the Exceptions Thrown by a Method (page 245)

Item 6

“Recognize situations that will result in any of the following being thrown: ArrayIndexOutOfBoundsException, AssertionError, ClassCastException, IllegalArgumentException, IllegalStateException, NullPointerException, NumberFormatException, ExceptionInInitializerError, StackOverflowError, or NoClassDefFoundError. Understand which of these are thrown by the virtual machine and recognize situations in which others should be thrown programatically.”

  • ArrayIndexOutOfBoundsException: Putting It All Together (page 241)

  • NullPointerException: How to Throw Exceptions (page 246)

  • NumberFormatException: Command-Line Arguments (page 448)

  • ClassCastException, IllegalStateException: Object Ordering (page 328)

  • IllegalStateException: The Queue Interface (page 316)

  • IllegalStateException: The List Interface (page 306)

Section 3: API Contents

Item 1

“Develop code that uses the primitive wrapper classes (such as Boolean, Character, Double, Integer, etc.), and/or autoboxing & unboxing. Discuss the differences between the String, StringBuilder, and StringBuffer classes.”

  • The Numbers Classes (page 195)

  • Characters (page 210)

  • Strings (page 212)

  • The StringBuilder Class (page 226)

Item 2

“Given a scenario involving navigating file systems, reading from files, or writing to files, develop the correct solution using the following classes (sometimes in combination), from java.io: BufferedReader, BufferedWriter, File, FileReader, FileWriter, and PrintWriter.”

  • FileReader, FileWriter: Character Streams (page 265)

  • BufferedReader, BufferedWriter: Buffered Streams (page 269)

  • PrintWriter: Formatting (page 272)

  • File: File Objects (page 286)

Item 3

“Develop code that serializes and/or de-serializes objects using the following APIs from java.io: DataInputStream, DataOutputStream, FileInputStream, FileOutputStream, ObjectInputStream, ObjectOutputStream, and Serializable.”

  • Data Streams (page 279)

  • Object Streams (page 282)

Item 4

“Use standard J2SE APIs in the java.text package to correctly format or parse dates, numbers, and currency values for a specific locale; and, given a scenario, determine the appropriate methods to use if you want to use the default locale or a specific locale. Describe the purpose and use of the java.util.Locale class.”

Item 5

“Write code that uses standard J2SE APIs in the java.util and java.util.regex packages to format or parse strings or streams. For strings, write code that uses the Pattern and Matcher classes and the String.split method. Recognize and use regular expression patterns for matching (limited to: . (dot), * (star), + (plus), ?, d, s, w, [], ()). 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. For streams, write code using the Formatter and Scanner classes and the PrintWriter.format/printf methods. Recognize and use formatting parameters (limited to: %b, %c, %d, %f, %s) in format strings.”

  • String split method: Manipulating Characters in a String (page 218)

  • Methods of the Pattern Class (page 425)

  • Methods of the Matcher Class (page 431)

  • Scanning (page 270)

  • Formatting (page 272)

  • PrintWriter, formatting parameters: Formatting (page 272)

  • formatting parameters: Formatting Numeric Print Output (page 198)

Section 4: Concurrency

Item 1

“Write code to define, instantiate, and start new threads using both java.lang.Thread and java.lang.Runnable.”

  • Defining and Starting a Thread (page 371)

  • The SimpleThreads Example (page 375)

Item 2

“Recognize the states in which a thread can exist, and identify ways in which a thread can transition from one state to another.”

Item 3

“Given a scenario, write code that makes appropriate use of object locking to protect static or instance variables from concurrent access problems.”

  • Thread Interference (page 377)

  • Memory Consistency Errors (page 379)

  • Synchronized Methods (page 380)

  • Intrinsic Locks and Synchronization (page 381)

  • Atomic Access (page 383)

Item 4

“Given a scenario, write code that makes appropriate use of wait, notify, or notifyAll.”

  • Guarded Blocks (page 386)

Section 5: OO Concepts

Item 1

“Develop code that implements tight encapsulation, loose coupling, and high cohesion in classes, and describe the benefits.”

Item 2

“Given a scenario, develop code that demonstrates the use of polymorphism. Further, determine when casting will be necessary and recognize compiler vs. runtime errors related to object reference casting.”

  • Inheritance (page 147)

Item 3

“Explain the effect of modifiers on inheritance with respect to constructors, instance or static variables, and instance or static methods.”

  • Inheritance (page 147)

  • Overriding and Hiding Methods (page 152)

  • Using the Keyword super (page 154)

Item 4

“Given a scenario, develop code that declares and/or invokes overridden or overloaded methods and code that declares and/or invokes superclass, overridden, or overloaded constructors.”

  • Overriding and Hiding Methods (page 152)

  • Defining Methods (page 90)

  • Using the Keyword super (page 154)

Item 5

“Develop code that implements ‘is-a’ and/or ‘has-a’ relationships.”

Section 6: Collections / Generics

Item 1

“Given a design scenario, determine which collection classes and/or interfaces should be used to properly implement that design, including the use of the Comparable interface.”

  • Object Ordering (page 328)

Item 2

“Distinguish between correct and incorrect overrides of corresponding hashCode and equals methods, and explain the difference between == and the equals method.”

  • Object as a Superclass (page 156)

Item 3

“Write code that uses the generic versions of the Collections API, in particular, the Set, List, and Map interfaces and implementation classes. Recognize the limitations of the non-generic Collections API and how to refactor code to use the generic versions.”

  • Generic Types (page 169)

Item 4

“Develop code that makes proper use of type parameters in class/interface declarations, instance variables, method arguments, and return types; and write generic methods or methods that make use of wildcard types and understand the similarities and differences between these two approaches.”

  • Declaring Classes (page 87)

  • Defining an Interface (page 142)

  • Passing Information to a Method or a Constructor (page 93)

  • Returning a Value from a Method (page 106)

  • Generic Types (page 169)

  • Generic Methods and Constructors (page 172)

  • Wildcards (page 177)

Item 5

“Use capabilities in the java.util package to write code to manipulate a list by sorting, performing a binary search, or converting the list to an array. Use capabilities in the java.util package to write code to manipulate an array by sorting, performing a binary search, or converting the array to a list. Use the java.util.Comparator and java.lang.Comparable interfaces to affect the sorting of lists and arrays. Furthermore, recognize the effect of the ‘natural ordering’ of primitive wrapper classes and java.lang.String on sorting.”

  • Algorithms (page 355)

Section 7: Fundamentals

Item 1

“Given a code example and a scenario, write code that uses the appropriate access modifiers, package declarations, and import statements to interact with (through access or inheritance) the code in the example.”

  • Controlling Access to Members of a Class (page 110)

  • Using Package Members (page 187)

Item 2

“Given an example of a class and a command-line, determine the expected runtime behavior.”

  • Command-Line Arguments (page 448)

  • Command-Line I/O Objects (page 452)

Item 3

“Determine the effect upon object references and primitive values when they are passed into methods that perform assignments or other modifying operations on the parameters.”

  • Passing Information to a Method or a Constructor (page 93)

Item 4

“Given a code example, recognize the point at which an object becomes eligible for garbage collection, and determine what is and is not guaranteed by the garbage collection system. Recognize the behaviors of System.gc and finalization.”

  • Using Objects (page 103)

Item 5

“Given the fully-qualified name of a class that is deployed inside and/or outside a JAR file, construct the appropriate directory structure for that class. Given a code example and a classpath, determine whether the classpath will allow the code to compile successfully.”

  • Managing Source and Class Files (page 191)

Item 6

“Write code that correctly applies the appropriate operators including assignment operators (limited to: =, +=, -=), arithmetic operators (limited to: +, -, *, /, %, ++, --), relational operators (limited to: <, <=, >, >=, ==, !=), the instanceof operator, logical operators (limited to: &, |, ^, !, &&, ||), and the conditional operator (? :), to produce a desired result. Write code that determines the equality of two objects or two primitives.

  • Assignment, Arithmetic, and Unary Operators (page 56)

  • Equality, Relational, and Conditional Operators (page 59)

  • Object as a Superclass (page 156)

  • Comparing Strings and Portions of Strings (page 224)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.234.24