Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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


  • Where can I find the official SCJP FAQ from Oracle?
  • What are the SCJP objectives?
  • Where can I find the Java Language Specification?
  • Where can I find the Java API documentation?


  • General Questions about the Exams


  • How is the OCAJP 7 and OCPJP 7 exam different from the SCJP/OCJP 1.6?
  • How is the SCJP 1.6 exam different from the SCJP 1.5?
  • Where can I find articles for SCJP 1.6?
  • What are the upgrade exams?
  • 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?
  • Is the upgrade exam easier than the full exam?
  • Can I bring something to write on?
  • How important are the scores?
  • If I fail, can I take the exam again?
  • How long will my certification last before expiring?
  • Where can I find information about certification outside of the U.S.?
  • What is the pattern of the expiration date on the exam voucher?
  • Will I be told how many options to choose in a multiple choice question?
  • Are there any marks for partially right answers?


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


  • What is the best way to prepare for the SCJP exam?
  • What books should I refer to when studying for the SCJP?
  • Where can I find preparation notes?
  • Are there supporting courses for preparing the exam?
  • What are some mock exams available? see ScjpMockTests
  • How does the user-interface of the real exam look like? Check ExamLab
  • Are there any mock exams that allow Exam Objectives section-wise tests?
  • Am I ready to take the exam?
  • What resources should I study to meet the Objectives for SCJP 310-025 exam?


  • Questions on Specific Topics


  • What are some potential trips/traps in the SCJP exam?
  • What are the Java standard keywords? Are true, false, and null keywords?
  • What does strictfp mean?
  • Can I have more than one class in a .java source file?
  • Is it allowed to declare the main method private?
  • Can static methods be overridden?
  • Are string literals eligible for GC?
  • char a = '\u000A'. Why is this invalid?
  • How can you compare NaN values?
  • How does InterruptedException affect a thread?
  • What are the important I/O constructors and methods?
  • What is the difference between getAbsolutePath() and getCanonicalPath()?
  • Could someone explain the Regex2 class from K&B's Java 5 Study Guide?
  • How many String objects are there? What is the String pool?
  • Why do separate autoboxing conversions sometimes return the same reference?
  • What is a most-specific method?
  • Why are the notify, notifyAll and wait methods defined in the Object class instead of the Thread class?
  • What's up with integers not being equal to one another?





  • 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.
  • SCJP 1.5 (310-055)
  • SCJP 1.5 Upgrade (310-056)
  • SCJP 1.6 (310-065)
  • SCJP 1.6 Upgrade (310-066)





  • 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:

  • SCJP 1.5 Upgrade (310-056)
  • SCJP 1.6 Upgrade (310-066)





  • 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?
     


  • Familiarize yourself with Oracle's exam process, including objectives, registration, testing, etc. See Oracle's SCJP page for details.
  • If you are new to Java programming, start with a good introductory book such as Head First Java or Thinking in Java. Check the JavaRanch Bunkhouse for additional recommendations and reviews. Refer to the API documentation and the Java Language Specifications along the way. (See links in this FAQ.)
  • Once you have a foundation, study at least one good (and current) certification preparation book. (See recommendations in this FAQ.)
  • Use the SCJP forum to post questions, and reinforce your own understanding by answering other people's questions.
  • Take as many mock exams as possible. (See links in this FAQ.) Use these to determine where additional study is needed, and as a guide to when you are ready.


  • 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.


  • Go through one book at a time, don't skip around between books because it will confuse you. Specifically with regard to the certification objectives, areas like Threads may be taught differently in different books. As such, its best to have one teacher at-a-time instead of numerous. Learning it multiple ways AT THE SAME TIME, will lead to confusion.
  • If you're brand-spanking new to Java, don't go directly to a Java Cert book. These books were not created for beginners, they were created for people who understand the basics of Java programming. Instead, spend a month or so getting to know the language with a "Learning Java" type book. If you are new to programming altogether, you may want to precede the learning java type book with a basic computer programming book.
  • Code Code Code. There is a lesson to be learned in every code example of every book you read. Learn the lessons and learn to code at the same time. The difference between someone who has spent the time to code and someone who is merely memorizing answers is immediately apparent in thier test progress. Someone who codes regularly will quickly pick-up on the intricate questions being asked on the exam. Someone who is memorizing answers will get lost easily once the questions deviate from what they've memorized. On the job, the memorized-no-coding person will be quickly fired, while also proving the test to be inneffective in the minds of the employer who f/hired them.
  • Study with friends. There's an old axiom that goes: "if you put 100 programmers in a room and give them 1 problem, you'll get 100 different answers, and most will work." By studying with others you'll be able to see how others approach the questions and exercises you'll be studying. When I study for a certification, my initial approach to a problem is rarely the best one. But if I'm studying with others, I can see many approaches and find out which one is best for me.
  • Use Mnemonic Devices. The thing about memorable mnemonics is that they help put information into your long-term memory instead of your near-short term memory. My favorite mnemonics are acronyms. Its amazing how memorable a lasciviously written acronym is. :-) Make 'em dirty to make 'em last.
  • Don't try to learn the entire language in a week/month, take your time. There's the French cognitive psychologist name Piaget who postulated that adults learn sequentially and cumulatively. Basically what this means is that before you can learn how to write an inner class, you first need to learn how to write a regular class. You can try and skip right to the inner class if you want, but you won't learn the "whys" of it. Its just as important for us human beings to learn the background of something as it is to learn the thing itself. Now, if you're a martian, venusian, or uranusian, that may not apply. if you are a venusian learning Java, I say welcome to our new Venusian Overlords!
  • Learn "why" something works a given way, not just that it works one way. Other psychologists have postulated that there are three stages to learning. There's recognizing something, rote memorization, and being able to create something new from your memorized material. This is usually applied to the learning of human languages, but it applied to Java Certification prep as well. Here's how they differ. Being able to recognize that something is written in Java is nice, but you have to know how to use the language also. Recognizing but not really being able to use is the first level. Not really useful. Being able to recite all parts of the Java Language is certainly better than just recognizing it. Unfortunately, being able to recite the number of bits in an Integer doesn't mean you'll be able to use it in code. Finally, being able to create algorithms in the language, that's where you want to be before you take your certification exam. That's what employers are looking for. That's why K&M ask you questions that make you think. And that's why the people that can use the language most effectively are the ones who don't get laid off.


  • 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?
     

  • 2nd edition (for Java 5), 3rd edition (for Java 6) and Java 7 edition: http://docs.oracle.com/javase/specs/





  • Where can I find the Java API documentation?
     

  • Java 7
  • Java SE 6 (aka 1.6)
  • Java SE APIs & Documentation





  • What are some mock exams available?
     


  • see ScjpMockTests




  • Where can I find preparation notes?
     


  • Suhrid Karthik's OCPJP 6 Notes
  • Frits Walraven: Summary of Study Guide (Sierra, Bates) also in pdf
  • Oracle's Java Tutorial section
  • Enthuware Resources
  • Dylan Walsh's Pre-Exam Essentials





  • Are there supporting courses for preparing the exam?
     


  • Whizlabs SCJP 6 Online Instructor led Training
  • Oracle Training





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

  • ENTHUWARE's JQ+ V6
  • CertPal
  • Exam EPractize Labs
  • Marcus Green's Site
  • JavaBeat Certification Kit
  • javaprepare.com
  • uCertify Java PrepKits
  • Nikos Blog
  • Whizlabs SCJP 6 Exam Simulator, OCPJP 7 Exam simulator, OCPJP 7 Upgrade Exam Simulator, Java Certification Kits





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


  • Exam objectives: Several new API classes/interfaces have been added: java.io.Console, java.util.NavigableSet, java.util.NavigableMap. Explicit garbage collector calls (i.e. System.gc()) will no longer be tested, but candidates will still be expected to understand garbage collection and the finalize() method. Also, the following topics will be tested in greater depth: exception handling, collections, assertions, threads, and flow control. See this topic, java.io.Console and java.util.NavigableSet for more detail.
  • Number of questions: 60
  • Time: 180 minutes
  • Passing score: 58.33% (35 of 60)
  • Format of questions: No change.




  • 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?
     


  • "If a Oracle certified professional has already received a certificate and ID card with the printed expiration date, can that professional request another certificate and ID card without an expiration date? Yes. The certified professional will need to send an email to the who2contact@sun.com alias to request a new certificate and ID card. Include your name and Prometric Candidate ID number."



  • "Beginning with all Oracle certification exams taken on or after August 1, 2003, certification offerings from Sun no longer have an expiration date. Rather, certification offerings are based on a version of technology."
  • For exams taken after September 1, 2002, but prior to August 1, 2003, "Recertification was required to maintain one's status as a certified Sun professional after two years."


  • 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?
     


  • Two top-level public classes cannot be in the same source file.
  • main() cannot call an instance (non-static) method.
  • Methods can have the same name as the constructor(s).
  • Watch for thread initiation with classes that don't have a run() method.
  • Local classes cannot access non-final variables.
  • Case statements must have values within permissible range.
  • Watch for Math class being an option for immutable classes.
  • instanceOf is not the same as instanceof.
  • Constructors can be private.
  • Assignment statements can be mistaken for a comparison; e.g., if(a=true)...
  • Watch for System.exit() in try-catch-finally blocks.
  • Watch for uninitialized variable references with no path of proper initialization.
  • Order of try-catch-finally blocks matters.
  • main() can be declared final.
  • -0.0 == 0.0 is true.
  • A class without abstract methods can still be declared abstract.
  • Map does not implement Collection.
  • Dictionary is a class, not an interface.
  • Collection (singular) is an Interface, but Collections (plural) is a helper class.
  • Class declarations can come in any order (e.g., derived first, base next, etc.).
  • Forward references to variables gives a compiler error.
  • Multi-dimensional arrays can be "sparse" -- i.e., if you imagine the array as a matrix, every row need not have the same number of columns.
  • Arrays, whether local or class-level, are always initialized
  • Strings are initialized to null, not empty string.
  • An empty string is not the same as a null reference.
  • A declaration cannot be labelled.
  • continue must be in a loop (e.g., for, do, while). It cannot appear in case constructs.
  • Primitive array types can never be assigned to each other, even though the primitives themselves can be assigned. For example, ArrayofLongPrimitives = ArrayofIntegerPrimitives gives compiler error even though longvar = intvar is perfectly valid.
  • A constructor can throw any exception.
  • Initializer blocks are executed in the order of declaration.
  • Instance initializers are executed only if an object is constructed.
  • All comparisons involving NaN and a non-NaN always result in false.
  • Default type of a numeric literal with a decimal point is double.
  • int and long operations / and % can throw an ArithmeticException, while float and double / and % never will (even in case of division by zero).
  • == gives compiler error if the operands are cast-incompatible.
  • You can never cast objects of sibling classes (sharing the same parent).
  • equals() returns false if the object types are different. It does not raise a compiler error.
  • No inner class (non-static inner class) can have a static member.
  • File class has no methods to deal with the contents of the file.
  • InputStream and OutputStream are abstract classes


  • 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


  • Exceptions in Java (July 1998) This article gives an in-depth account of exceptions in the Java language and virtual machine.
  • Designing with Exceptions (July 1998) This article discusses design guidelines concerning when and how to use exceptions.


  • Section 3 Garbage Collection

  • Bill Venners Object finalization and cleanup


  • Section 4 Language Fundamentals


  • Object Initialization in Java (March 1998) -- This article describes in detail the process of object initialization in Java programs. It discusses constructors, initializers, instance initialization (init) methods, initialization and inheritance, object images on the heap, and the order in which an object's variables get initialized. It serves as a companion to the regular Design Techniques installment, "Designing object Initialization."
  • Designing Object Initialization (March 1998) -- This installment of Design Techniques begins with a quick look at object design fundamentals, then goes on to discuss various approaches to designing initializers and constructors so as to facilitate the proper initialization of objects.
  • Designing with Static Members (March 1999) -- This article discusses how to use static fields and methods.
  • Inner classes. So what are inner classes good for anyway? (JavaWorld)
  • Java Tip 106: Static inner classes for fun and profit This tip provides an example of using static inner classes to add separate, optional, supplemental functionality to your classes for such things as testing and example code. By John D. Mitchell


  • Section 7 Threads


  • Oracle's tutorial
  • Synchronizing threads in Java
  • Java Threads, By Scott Oaks & Henry Wong Chapter 1. Introduction to Threading


  • Section 10 The java.util PACKAGE

  • Introduction to the Collections Framework. Short Course By MageLang Institute
  • Using Collections with JDK1.2 by Glen McCluskey


  • Section 11 The java.io PACKAGE

  • Top Ten Myths about Java I/O by Elliotte Rusty Harold
  • Examples from Java I/O (from "Java I/O" By Elliotte Rusty Harold)





  • 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 public, 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 public. 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:

  • in running state: No exception is thrown. However the interrupted flag is set, which means that if you call interrupted() or isInterrupted(), they will return true. It is up to the running target thread to check the flag and to take some action, but it is perfectly possible to ignore this flag. If the thread later goes from running state to waiting or sleeping state before interrupted flag is cleared via interrupted() method, then an InterruptedException will be thrown and the flag will be cleared.
  • in waiting/sleeping state: The thread moves into ready state, and when it next gets a chance to execute an InterruptedException is thrown. No flag is set, so interrupted() returns false.
  • in ready state: If an interrupt() is called while a thread is in ready state, nothing happens until the thread moves back to running state. Once the thread has moved to running state, then see answer for running state, above.


  • 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?
     


  • Hierarchy of IO classes.
  • The interfaces and abstract classes, as well as the concrete classes implementing these.
  • The "chaining" of one stream to another to achieve the desired result. (Given a requirement, you should be able to choose the best possible way to chain streams together.)
  • Different character encodings, and the IO classes capable of making use of the encoding specifications.
  • How FileInputStream, FileOutputStream, RandomAccessFile may be constructed using File or String arguments.
  • The PrintStream class and the overloaded println() methods defined in it. The autoflush mechanism.
  • The RandomAccessFile class (pay attention to the constructor and the methods to move your file pointer back and forth). You should be able to calculate how many bytes the pointer moves when you read/write different data types. Know the two possible arguments that control read/read-write access to a RandomAccessFile.
  • The hierarchy of IOExceptions, and the methods in the IO classes that throw exceptions.
  • The File class, including all the overloaded constructors and various methods that permanently affect the underlying file system, and that determine various properties of the underlying file.





  • 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:

  • true or false
  • a byte
  • a short or int in the range of a byte (-128 to 127)
  • a char in the range of \u0000 to \u007f (0 to 127)


  • 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


  • Add question about Oracle logo use: How to register, how long it takes, etc.



  • CategoryFaq CategoryCertification
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
      Bookmark Topic Watch Topic
    • New Topic