You are previewing SCJP Sun Certified Programmer for Java 6 Study Guide.
O'Reilly logo
SCJP Sun Certified Programmer for Java 6 Study Guide

Book Description

The Best Fully Integrated Study System Available--Written by the Lead Developers of Exam 310-065

With hundreds of practice questions and hands-on exercises, SCJP Sun Certified Programmer for Java 6 Study Guide covers what you need to know--and shows you how to prepare--for this challenging exam.

  • 100% complete coverage of all official objectives for exam 310-065
  • Exam Objective Highlights in every chapter point out certification objectives to ensure you're focused on passing the exam
  • Exam Watch sections in every chapter highlight key exam topics covered
  • Simulated exam questions match the format, tone, topics, and difficulty of the real exam

Covers all SCJP exam topics, including:

Declarations and Access Control · Object Orientation · Assignments · Operators · Flow Control, Exceptions, and Assertions · Strings, I/O, Formatting, and Parsing · Generics and Collections · Inner Classes · Threads · Development

CD-ROM includes:

  • Complete MasterExam practice testing engine, featuring: Two full practice exams; Detailed answers with explanations; Score Report performance assessment tool
  • Electronic book for studying on the go
  • Bonus coverage of the SCJD exam included!

Bonus downloadable MasterExam practice test with free online registration.

Table of Contents

  1. Cover Page
  2. SCJP Sun® Certified Programmer for Java™ 6 Study Guide (Exam 310-065)
  3. Copyright Page
  4. CD Content
  5. Contents
  6. Contributors
  7. Acknowledgments
  8. Preface
  9. Introduction
  10. 1 Declarations and Access Control
    1. Java Refresher
    2. Identifiers & JavaBeans (Objectives 1.3 and 1.4)
      1. Legal Identifiers
      2. Sun's Java Code Conventions
      3. JavaBeans Standards
    3. Declare Classes (Exam Objective 1.1)
      1. Source File Declaration Rules
      2. Class Declarations and Modifiers
      3. Exercise 1-1: Creating an Abstract Superclass and Concrete Subclass
    4. Declare Interfaces (Exam Objectives 1.1 and 1.2)
      1. Declaring an Interface
      2. Declaring Interface Constants
    5. Declare Class Members (Objectives 1.3 and 1.4)
      1. Access Modifiers
      2. Nonaccess Member Modifiers
      3. Constructor Declarations
      4. Variable Declarations
      5. Declaring Enums
    6. Two-Minute Drill
    7. Q&A Self Test
      1. Self Test Answers
  11. 2 object orientation
    1. Encapsulation (Exam Objective 5.1)
    2. Inheritance, Is-A, Has-A (Exam Objective 5.5)
      1. IS-A
      2. HAS-A
    3. Polymorphism (Exam Objective 5.2)
    4. Overriding / Overloading (Exam Objectives 1.5 and 5.4)
      1. Overridden Methods
      2. Overloaded Methods
    5. Reference Variable Casting (Objective 5.2)
    6. Implementing an Interface (Exam Objective 1.2)
    7. Legal Return Types (Exam Objective 1.5)
      1. Return Type Declarations
      2. Returning a Value
    8. Constructors and Instantiation (Exam Objectives 1.6, 5.3, and 5.4)
      1. Determine Whether a Default Constructor Will Be Created
      2. Overloaded Constructors
    9. Statics (Exam Objective 1.3)
      1. Static Variables and Methods
    10. Coupling and Cohesion (Exam Objective 5.1)
    11. Two-Minute Drill
    12. Q&A Self Test
      1. Self Test Answers
  12. 3 Assignments
    1. Stack and Heap—Quick Review
    2. Literals, Assignments, and Variables (Exam Objectives 1.3 and 7.6)
      1. Literal Values for All Primitive Types
      2. Assignment Operators
      3. Exercise 3-1: Casting Primitives
      4. Using a Variable or Array Element That Is Uninitialized and Unassigned
      5. Local (Stack, Automatic) Primitives and Objects
    3. Passing Variables into Methods (Objective 7.3)
      1. Passing Object Reference Variables
      2. Does Java Use Pass-By-Value Semantics?
      3. Passing Primitive Variables
    4. Array Declaration, Construction, and Initialization (Exam Objective 1.3)
      1. Declaring an Array
      2. Constructing an Array
      3. Initializing an Array
      4. Initialization Blocks
    5. Using Wrapper Classes and Boxing (Exam Objective 3.1)
      1. An Overview of the Wrapper Classes
      2. Creating Wrapper Objects
      3. Using Wrapper Conversion Utilities
      4. Autoboxing
    6. Overloading (Exam Objectives 1.5 and 5.4)
    7. Garbage Collection (Exam Objective 7.4)
      1. Overview of Memory Management and Garbage Collection
      2. Overview of Java's Garbage Collector
      3. Writing Code That Explicitly Makes Objects Eligible for Collection
      4. Exercise 3-2: Garbage Collection Experiment
    8. Two-Minute Drill
    9. Q&A Self Test
      1. Self Test Answers
  13. 4 operators
    1. Java Operators (Exam Objective 7.6)
      1. Assignment Operators
      2. Relational Operators
      3. instanceof Comparison
      4. Arithmetic Operators
      5. Conditional Operator
      6. Logical Operators
    2. Two-Minute Drill
    3. Q&A Self Test
      1. Self Test Answers
  14. 5 Flow Control, exceptions, and Assertions
    1. if and switch Statements (Exam Objective 2.1)
      1. if-else Branching
      2. switch Statements
      3. Exercise 5-1: Creating a switch-case Statement
    2. Loops and Iterators (Exam Objective 2.2)
      1. Using while Loops
      2. Using do Loops
      3. Using for Loops
      4. Using break and continue
      5. Unlabeled Statements
      6. Labeled Statements
      7. Exercise 5-2: Creating a Labeled while Loop
    3. Handling Exceptions (Exam Objectives 2.4 and 2.5)
      1. Catching an Exception Using try and catch
      2. Using finally
      3. Propagating Uncaught Exceptions
      4. Exercise 5-3: Propagating and Catching an Exception
      5. Defining Exceptions
      6. Exception Hierarchy
      7. Handling an Entire Class Hierarchy of Exceptions
      8. Exception Matching
      9. Exception Declaration and the Public Interface
      10. Rethrowing the Same Exception
      11. Exercise 5-4: Creating an Exception
    4. Common Exceptions and Errors (Exam Objective 2.6)
    5. Working with the Assertion Mechanism (Exam Objective 2.3)
      1. Assertions Overview
      2. Enabling Assertions
      3. Using Assertions Appropriately
    6. Two-Minute Drill
    7. Q&A Self Test
      1. Self Test Answers
  15. 6 Strings, I/O, Formatting, and Parsing
    1. String, StringBuilder, and StringBuffer (Exam Objective 3.1)
      1. The String Class
      2. Important Facts About Strings and Memory
      3. Important Methods in the String Class
      4. The StringBuffer and StringBuilder Classes
      5. Important Methods in the StringBuffer and StringBuilder Classes
    2. File Navigation and I/O (Exam Objective 3.2)
      1. The java.io.Console Class
    3. Serialization (Exam Objective 3.3)
    4. Dates, Numbers, and Currency (Exam Objective 3.4)
      1. Working with Dates, Numbers, and Currencies
    5. Parsing, Tokenizing, and Formatting (Exam Objective 3.5)
      1. A Search Tutorial
      2. Locating Data via Pattern Matching
      3. Tokenizing
      4. Formatting with printf() and format()
    6. Two-Minute Drill
    7. Q&A Self Test
      1. Self Test Answers
  16. 7 Generics and Collections
    1. Overriding hashCode() and equals() (Objective 6.2)
      1. Overriding equals()
      2. Overriding hashCode()
    2. Collections (Exam Objective 6.1)
      1. So What Do You Do with a Collection?
      2. List Interface
      3. Set Interface
      4. Map Interface
      5. Queue Interface
    3. Using the Collections Framework (Objectives 6.3 and 6.5)
      1. ArrayList Basics
      2. Autoboxing with Collections
      3. Sorting Collections and Arrays
      4. Navigating (Searching) TreeSets and TreeMaps
      5. Other Navigation Methods
      6. Backed Collections
    4. Generic Types (Objectives 6.3 and 6.4)
      1. Generics and Legacy Code
      2. Mixing Generic and Non-generic Collections
      3. Polymorphism and Generics
      4. Generic Methods
      5. Generic Declarations
    5. Two-Minute Drill
    6. Q&A Self Test
      1. Self Test Answers
  17. 8 Inner Classes
    1. Inner Classes
      1. Coding a "Regular" Inner Class
      2. Referencing the Inner or Outer Instance from Within the Inner Class
    2. Method-Local Inner Classes
      1. What a Method-Local Inner Object Can and Can't Do
    3. Anonymous Inner Classes
      1. Plain-Old Anonymous Inner Classes, Flavor One
      2. Plain-Old Anonymous Inner Classes, Flavor Two
      3. Argument-Defined Anonymous Inner Classes
    4. Static Nested Classes
      1. Instantiating and Using Static Nested Classes
    5. Two-Minute Drill
    6. Q&A Self Test
      1. Self Test Answers
  18. 9 Threads
    1. Defining, Instantiating, and Starting Threads (Objective 4.1)
      1. Defining a Thread
      2. Instantiating a Thread
      3. Starting a Thread
    2. Thread States and Transitions (Objective 4.2)
      1. Thread States
      2. Preventing Thread Execution
      3. Sleeping
      4. Exercise 9-1: Creating a Thread and Putting It to Sleep
      5. Thread Priorities and yield( )
    3. Synchronizing Code (Objective 4.3)
      1. Synchronization and Locks
      2. Exercise 9-2: Synchronizing a Block of Code
      3. Thread Deadlock
    4. Thread Interaction (Objective 4.4)
      1. Using notifyAll( ) When Many Threads May Be Waiting
    5. Two-Minute Drill
    6. Q&A Self Test
      1. Self Test Answers
      2. Exercise Answers
  19. 10 Development
    1. Using the javac and java Commands (Exam Objectives 7.1, 7.2, and 7.5)
      1. Compiling with javac
      2. Launching Applications with java
      3. Searching for Other Classes
    2. JAR Files (Objective 7.5)
      1. JAR Files and Searching
    3. Using Static Imports (Exam Objective 7.1)
      1. Static Imports
    4. Two-Minute Drill
    5. Q&A Self Test
      1. Self Test Answers
  20. A About the Download
    1. Steps to Download MasterExam
    2. System Requirements
    3. MasterExam
    4. Additional Chapters
    5. Help
    6. Removing Installation
    7. Technical Support
    8. LearnKey Technical Support
  21. Index
  22. For Download