Ocjp Faq (Wiki forum at Coderanch) (original) (raw)

Please use the SCJP forum to post your own question, and list yourself on the ScjpWallOfFame if you mastered the exam. See OcpjpFaq for Java 7 exam content.


SCJP FAQ Contents

Questions about Oracle Resources

General Questions about the Exams

Questions about Exam Preparation (Books, Notes, Mock Exams, etc.)

Questions on Specific Topics


Where can I find the official SCJP FAQ from Oracle?

http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=516&p_org_id=28


What are the SCJP objectives?

Objectives are the goals for the exam to prepare you on certain topics. You can think of objectives as Syllabus of the exam.


What are the upgrade exams?

The upgrade exams are for candidates who already hold an SCJP certification under a prior version and want to be certified under a more recent version. For example, if you have already passed the SCJP 1.4 exam and want to upgrade your certification to version 1.5, then you can take the SCJP 1.5 Upgrade exam.

For more information see:


If my last SCJP was 1.4 can I take the 1.6 upgrade or do I have to take the full 1.6 exam?

No. You can just take the upgrade exam. As long as you have SCJP in any previous version you can take any SCJP upgrade.


Is the upgrade exam easier than the full exam?

Well there are less questions but the pass mark is slightly higher. The upgrade has 48 questions, a 66% pass mark and allows 150 minutes (3.125 minutes per question). The full exam has 60 questions, a 58.33% pass mark and allows 180 minutes (3 mins per question).


What is the best way to prepare for the SCJP exam?

Contributed by Mike Van...

In my dark and horrid past, I ran an organization that prepared newcomers for the Java Cert exam. As such, I have some insight you may find useful.

Contributed by Rahul Bhattacharjee, SCJP1.4...

Apart from the programming questions one should also concentrate on the theory (encapsulation...) also. As the basic theory questions would also have the same weightage.

Check this link for the features new to JDK 1.5.


What books should I refer to when studying for the SCJP?

SCJP Sun Certified Programmer for Java 6 Study Guide by Katherine Sierra and Bert Bates (K&B) is One of the most popular (and recommended) book for SCJP -- ISBN 0071591060. The Java 5 Study Guide is also available -- ISBN 0072253606.

A Programmer's Guide to Java SCJP Certification: A Comprehensive Primer by Khalid A. Mughal and Rolf W. Rasmussen -- ISBN 0321556054.

Check the JavaRanch Bunkhouse for additional recommendations and reviews.


Where can I find the Java Language Specification?


Where can I find the Java API documentation?


What are some mock exams available?


Where can I find preparation notes?


Are there supporting courses for preparing the exam?


Are there any mock exams that allow Exam Objectives section-wise tests?


How is the SCJP 1.6 exam different from the SCJP 1.5?


Can I bring something to write on?

You cannot bring anything with you into the testing room. You will be provided with something to write on and something to write with. This varies by testing center, but often it is a small erasable white board and a marker. You cannot take anything with you from the testing room when you leave.

If you have any doubts or concerns about this policy, please verify with your testing center before appearing for the exam.


How important are the scores?

Scores are not displayed on certificates (passing is passing), but scores can look impressive on resumes.


If I fail, can I take the exam again?

Yes, but you will need to purchase another voucher and wait 1 week before retesting.


How long will my certification last before expiring?

See Oracle's Certification FAQ for details.


Where can I find information about SCJP testing outside of the U.S.?

In the top navigation of Oracle's SCJP page there is an option of "Training Locations" from where you can select your country and find contact information.


What is the pattern of the expiration date on the exam voucher?

The pattern of the date on the voucher is MM/DD/YYYY. So if it says 5/10/2009, it means the voucher expires on May 10th, 2009.


Will I be told how many options to choose in a multiple choice question?

Yes in the real exam you'll be told how many options to select. The real exam won't have questions like in most mock exams which say "Choose All That Apply". That is done in mock exams to make them difficult.


Are there any marks for partially right answers?

There are no points for partially correct answers. If there is a question where you have to select 3 options and you select 2 right and 1 wrong, you'll get no marks for that question.


What are some potential trips/traps in the SCJP exam?

Also see Top Ten Errors Java Programmers Make by David Reilly.


Am I ready to take the exam?

The best way to convince yourself that you are ready is to consistently score well on mock exams. In general, most mock exams provide a good indication of how you will score on the real exam. (If anything, the real exams are said to be slightly less difficult than the mock exams. But since the real exam is usually the last one taken after a series of several mock exams, candidates are most prepared for that one.) As a general guideline for confidence, you should consistently score about 10 points higher on the mock exams as you hope to score on the real exam.


What resources should I study to meet the Objectives for SCJP 310-025 exam?

SCJP resources based on Oracle's objectives, PLEASE NOTE: These are resources based on an older exam, much of the material is still of great use but bear in mind Cavaet Emptor!

Section 2 Flow control and exception handling

Section 3 Garbage Collection

Section 4 Language Fundamentals

Section 7 Threads

Section 10 The java.util PACKAGE

Section 11 The java.io PACKAGE


char a = '\u000A'. Why is this invalid?

Unicode escape characters of the form '\Uxxxx', where xxxx is a hexadecimal value, are processed very early in the translation process (see JLS 3.10.4 ). As a result, the special characters '0A' (line feed) and '0D' (carriage return) are interpreted literally as "end of line."

For example, the expression...

...therefore becomes...

...which results in a compile-time error.

To avoid this error, always use the special escape characters '\n' (line feed) and '\r' (carriage return).


What are the Java standard keywords? Are true, false, and null keywords?

Java keywords are listed in the Java Tutorial: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html

"true, false, and null are not keywords but they are reserved words, so you cannot use them as names..."


What does strictfp mean?

The strictfp modifier can be used with top-level classes, nested classes, nested interfaces, and method declarations. It can not be used with variables, constructors, or initializer blocks. It also cannot be combined with the abstract modifier.

If an expression is FP-strict, all intermediate values should fit into the range for float or double variables. If an expression is not FP-strict, there are no such restrictions.

A non-constant expression is considered FP-strict if any of the class, interface or method declarations that contain the expression have the strictfp modifier.


Is it allowed to declare the main method private?

Former JVM versions (pre-1.4) allowed the main method to have any accessibility (private, etc). This incompatibility with Section 12.1.4 of the Java Language Specification has been fixed as of version 1.4. In order to invoke a main method from the command-line, it is now mandatory to declare the main method as follows:

If the main method has any access level other than coderanch, it will no longer run from the command-line.


Can I have more than one class in a .java source file?

Yes. However, each .java source file can contain at most one top-level class (or interface) definition that is coderanch. If a top-level public class (or interface) definition is present, then the .java source file must share that name exactly (matching case).


Can static methods be overridden?

static methods cannot be overridden, but they can be hidden (if not final). See Overriding vs Hiding for details.


How can you compare NaN values?

Except for NaN, floating-point values are ordered; arranged from smallest to largest, they are negative infinity, negative finite nonzero values, negative zero, positive zero, positive finite nonzero values, and positive infinity.

NaN is unordered, so the numerical comparison operators <, <=, >, and >= always return false if either or both operands are NaN. The equality operator == returns false if either operand is NaN. The inequality operator != returns true if either operand is NaN. In particular, x != x is true if and only if x is NaN, and (x == y) will be false if x or y is NaN.

For any value of x, including NaN itself, each of the following comparisons will return false.

Double.NaN != Double.NaN will always return true.

Note: The above relationships involving Double.NaN also apply to Float.NaN.


Are string literals eligible for GC?

The objects created in the String pool are not subjected to GC until the class is unloaded by the JVM. They get discarded at that time or just before the virtual machine unloads the class' bytecode. For the purpose of the SCJP exam, you are not required to know the details of String pool memory management.


How does InterruptedException affect a thread?

All InterruptedExceptions are caused by interrupt() method calls, (although not all interrupt() calls cause InterruptedExceptions). The effect differs depending upon in which state a target thread is. When a thread is:

Summarizing, interrupt() does not stop the target thread, in other words, there is no guarantee that a thread on which interrupt() was invoked will be stopped. Nevertheless, interrupt() method call may stop a thread, depending on circumstances listed above.


What are the important I/O constructors and methods?


getCanonicalPath() returns an absolute pathname in which all relative references and references to the current user directory have been completely resolved.

getAbsolutePath() returns the absolute pathname which is a concatenation of the current user directory, the separator character, and the pathname of the file object.

The absolute path includes the drive name and the top-level directories, as well as the file name itself. All canonical paths are absolute (but not all absolute paths are canonical). A single file existing on a system can have many different paths that refer to it, but only one canonical path.

Let's suppose there are two directories in Windows:

and

And there is a file in OneDirectory named MyFile. Then we can specify this file in a variety of ways (note that the File class interprets the Unix and Windows path separators '/' and '\' the same, except that '\' must be represented with the escape sequence '\\' in a String):

In Java under Windows, all the above are possible absolute paths for the same file. But since they all refer to the same file, that file is represented by one and only one canonical path:

The canonical form ensures that you can compare safely two file paths, i.e. if they point to the same file or directory, they will be equal.

Also note that getCanonicalPath() method may throw an IOException because the construction of the canonical pathname may require file system queries, whereas getAbsolutePath() never throws an exception.


Could someone explain the Regex2 class from K&B's Java 5 Study Guide?

There is some confusion regarding the following class (from the SCJP Sun Certified Programmer for Java 5 Study Guide by Katherine Sierra and Bert Bates)...

When this is compiled and run with java Regex2 "\d*" ab34ef the output is 01234456, which prompts the question: "Where does the '6' come from?"

The '6' comes from the last index in the String ab34ef i.e. index 6. This index contains a zero-length substring which can be accessed as follows

Note that this index does not contain a character and so

will throw

The asterisk (*) is a "greedy quantifier," specifying that whatever precedes it (in this case, any digit) should be matched zero or more times. By allowing for zero occurrences, a match of zero length is possible. Because a match of zero length is possible, the find() method will find the zero-length substring at index 6.

Note that for a match of zero length, the matcher's start() and end() methods both return the same index. In these cases, the group() method returns an empty String (i.e., the substring from start() to end()).

So in the above example, the find() method locates the following matches:

For more detailed information, see this Oracle tutorial on regex quantifiers.


How many String objects are there? What is the String pool?

See Corey McGlone's article Strings, Literally .


Why do separate autoboxing conversions sometimes return the same reference?

Two autoboxing conversions of a primitive value p will yield an identical reference (that is, the == comparison will return true) if p is:

Note: The Java Language Specification does not explicitly guarantee this behavior for long values within the range of a byte.

For additional details, see Autoboxing and Unboxing .


"Where can I find articles for SCJP 1.6?"

Articles covering the new topics in SCJP 1.6 can be found here.

What is a most-specific method?

Suppose that more than one version of an overloaded method applies to a particular call. For example, suppose that Cat extends Animal, and a method is overloaded to take either of these types as an argument.

Further, suppose that "milton" references an instance of Cat. That is...

Now, since a Cat is also an Animal, which method will be invoked with the following call?

In this situation, Java invokes the "most-specific" method, as detailed in section 15.12.2.2 of the Java Language Specification. In general, one method is considered more specific than another if its argument types are subtypes of the other method's respective argument types. So because Cat is a subtype of Animal, the method overloaded to accept a Cat is more specific than the method overloaded to accept an Animal. Therefore, method(Cat cat) will be invoked by the call method(milton).

If it's not possible to identify a most-specific method from among the applicable methods, then the invocation is considered "ambiguous" and results in a compile-time error.

Note, however, that a null reference could apply to any object type. Therefore, the call method(null) would also invoke the most specific method -- in this case, method(Cat cat).


Why are the notify, notifyAll and wait methods defined in the Object class instead of the Thread class?

See this thread and this thread for answers.


Where do I see my certification results?
See our certview wiki page


ToDo


CategoryFaq CategoryCertification