Docsity
Docsity

Prepare-se para as provas
Prepare-se para as provas

Estude fácil! Tem muito documento disponível na Docsity


Ganhe pontos para baixar
Ganhe pontos para baixar

Ganhe pontos ajudando outros esrudantes ou compre um plano Premium


Guias e Dicas
Guias e Dicas

SCJP Sun Certified Programmer for Java 6, Notas de estudo de Informática

Para estudo de certificação JAVA

Tipologia: Notas de estudo

2015

Compartilhado em 09/03/2015

felipe-carvalho-fgq
felipe-carvalho-fgq 🇧🇷

1 documento

1 / 890

Toggle sidebar

Esta página não é visível na pré-visualização

Não perca as partes importantes!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Pré-visualização parcial do texto

Baixe SCJP Sun Certified Programmer for Java 6 e outras Notas de estudo em PDF para Informática, somente na Docsity!

Praise for the Sun Certified Programmer & Developer for Java 2 Study Guide

"Kathy Sierra is one of the few people in the world who can make complicated things seem damn simple. And as if that isn't enough, she can make boring things seem interesting. I always look forward to reading whatever Kathy writes—she's one of my favorite authors." —Paul Wheaton, Trail Boss JavaRanch.com

"Who better to write a Java study guide than Kathy Sierra, the reigning queen of Java instruction? Kathy Sierra has done it again—here is a study guide that almost guarantees you a certification!" —James Cubeta, Systems Engineer, SGI

"The thing I appreciate most about Kathy is her quest to make us all remember that we are teaching people and not just lecturing about Java. Her passion and desire for the highest quality education that meets the needs of the individual student is positively unparalleled at SunEd. Undoubtedly there are hundreds of students who have benefited from taking Kathy's classes." —Victor Peters, founder Next Step Education & Software Sun Certified Java Instructor

"I want to thank Kathy for the EXCELLENT Study Guide. The book is well written, every concept is clearly explained using a real life example, and the book states what you specifically need to know for the exam. The way it's written, you feel that you're in a classroom and someone is actually teaching you the difficult concepts, but not in a dry, formal manner. The questions at the end of the chapters are also REALLY good, and I am sure they will help candidates pass the test. Watch out for this Wickedly Smart book." —Alfred Raouf, Web Solution Developer

"The Sun Certification exam was certainly no walk in the park, but Kathy's material allowed me to not only pass the exam, but Ace it!" —Mary Whetsel, Sr. Technology Specialist, Application Strategy and Integration, The St. Paul Companies

"Bert has an uncanny and proven ability to synthesize complexity into simplicity offering a guided tour into learning what's needed for the certification exam." —Thomas Bender, President, Gold Hill Software Design, Inc.

SCJP Sun

Certifi ed

Programmer for Java

Study Guide

(Exam 310-065)

Copyright © 2008 by The McGraw-Hill Companies. All rights reserved. Manufactured in the United States of America. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher.

0-07-159107-

The material in this eBook also appears in the print version of this title: 0-07-159106-0.

All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.

McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. For more information, please contact George Hoare, Special Sales, at george_hoare@mcgraw-hill.com or (212) 904-4069.

TERMS OF USE

This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGraw-Hill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms.

THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.

DOI: 10.1036/

Technical Review Superstars

Andrew

Bill M.

Burk (^) Devender

Gian

Jim Jef Jeroen

Kristin Marcelo^ Marilyn Johannes

Mark Mikalai Seema^ Valentin

We don't know who burned the most midnight oil, but we can (and did) count everybody's edits— so in order of most edits made, we proudly present our Superstars. Our top honors go to Kristin Stromberg —every time you see a semicolon used correctly, tip your hat to Kristin. Next up is Burk Hufnagel who fixed more code than we care to admit. Bill Mietelski and Gian Franco Casula caught every kind of error we threw at them—awesome job, guys! Devender Thareja made sure we didn't use too much slang, and Mark Spritzler kept the humor coming. Mikalai Zaikin and Seema Manivannan made great catches every step of the way, and Marilyn de Queiroz and Valentin Crettaz both put in another stellar performance (saving our butts yet again).

Marcelo Ortega , Jef Cumps (another veteran), Andrew Monkhouse , and Jeroen Sterken rounded out our crew of superstars—thanks to you all. Jim Yingst was a member of the Sun exam creation team, and he helped us write and review some of the twistier questions in the book (bwa-ha-ha-ha). As always, every time you read a clean page, thank our reviewers, and if you do catch an error, it's most certainly because your authors messed up. And oh, one last thanks to Johannes. You rule dude!

The Java 6 Elite Review Team Since the upgrade to the Java 6 exam was a like a small, surgical strike we decided that the technical review team for this update to the book needed to be similarly fashioned. To that end we hand- picked an elite crew of JavaRanch's top gurus to perform the review for the Java 6 exam.

Marc Peabody gets special kudos for helping us out on a double header! In addition to helping us with Sun's new SCWCD exam, Marc pitched in with a great set of edits for this book—you saved our bacon this winter Marc! (BTW, we didn't learn until late in the game that Marc, Bryan Basham, and Bert all share a passion for ultimate Frisbee!) Like several of our reviewers, not only does Fred Rosenberger volunteer copious amounts of his time moderating at JavaRanch, he also found time to help us out with this book. Stacey and Olivia, you have our thanks for loaning us Fred for a while. Marc Weber moderates at some of JavaRanch's busiest forums. Marc knows his stuff, and uncovered some really sneaky problems that were buried in the book. While we really appreciate Marc's help, we need to warn you all to watch out—he's got a Phaser! Finally, we send our thanks to Christophe Verre —if we can find him. It appears that Christophe performs his JavaRanch moderation duties from various locations around the globe, including France, Wales, and most recently Tokyo. On more than one occasion Christophe protected us from our own lack of organization. Thanks for your patience, Christophe! It's important to know that these guys all donated their reviewer honorariums to JavaRanch! The JavaRanch community is in your debt.

Marc W.

Marc P.

Fred

Christophe

Mikalai

Our endless gratitude goes to Mikalai Zaikin. Mikalai played a huge role in the Java 5 book, and he returned to help us out again for this Java 6 edition. We need to thank Volha, Anastasia, and Daria for letting us borrow Mikalai. His comments and edits helped us make huge improvements to the book. Thanks, Mikalai!

xi

xiv SCJP Sun Certifi ed Programmer for Java 6 Study Guide

  • 1 Declarations and Access Control CONTENTS AT A GLANCE
  • 2 Object Orientation
  • 3 Assignments
  • 4 Operators
  • 5 Flow Control, Exceptions, and Assertions
  • 6 Strings, I/O, Formatting, and Parsing
  • 7 Generics and Collections
  • 8 Inner Classes
  • 9 Threads
  • 10 Development
  • A About the CD - Index
  • 2 Object Orientation
    • Encapsulation (Exam Objective 5.1)
    • Inheritance, Is-A, Has-A (Exam Objective 5.5) - IS-A - HAS-A
    • Polymorphism (Exam Objective 5.2)
    • Overriding / Overloading (Exam Objectives 1.5 and 5.4) - Overridden Methods - Overloaded Methods
    • Reference Variable Casting (Objective 5.2)
    • Implementing an Interface (Exam Objective 1.2)
    • Legal Return Types (Exam Objective 1.5) - Return Type Declarations - Returning a Value
      • (Exam Objectives 1.6, 5.3, and 5.4) Constructors and Instantiation - Will Be Created Determine Whether a Default Constructor - Overloaded Constructors
    • Statics (Exam Objective 1.3) - Static Variables and Methods
    • Coupling and Cohesion (Exam Objective 5.1) - ✓ Two-Minute Drill
    • Q&A Self Test - Self Test Answers
  • 3 Assignments
    • Stack and Heap—Quick Review
      • (Exam Objectives 1.3 and 7.6) Literals, Assignments, and Variables - Literal Values for All Primitive Types - Assignment Operators - Exercise 3-1: Casting Primitives - and Unassigned Using a Variable or Array Element That Is Uninitialized - Local (Stack, Automatic) Primitives and Objects
    • Passing Variables into Methods (Objective 7.3) Contents xv - Passing Object Reference Variables - Does Java Use Pass-By-Value Semantics? - Passing Primitive Variables
      • (Exam Objective 1.3) Array Declaration, Construction, and Initialization - Declaring an Array - Constructing an Array - Initializing an Array - Initialization Blocks
    • Using Wrapper Classes and Boxing (Exam Objective 3.1) - An Overview of the Wrapper Classes - Creating Wrapper Objects - Using Wrapper Conversion Utilities - Autoboxing
    • Overloading (Exam Objectives 1.5 and 5.4)
    • Garbage Collection (Exam Objective 7.4) - Garbage Collection Overview of Memory Management and - Overview of Java's Garbage Collector - for Collection Writing Code That Explicitly Makes Objects Eligible - Exercise 3-2: Garbage Collection Experiment - ✓ Two-Minute Drill
    • Q&A Self Test - Self Test Answers
  • 4 Operators
    • Java Operators (Exam Objective 7.6) - Assignment Operators - Relational Operators - instanceof Comparison - Arithmetic Operators - Conditional Operator - Logical Operators - ✓ Two-Minute Drill
    • Q&A Self Test - Self Test Answers
  • 5 Flow Control, Exceptions, and Assertions xvi SCJP Sun Certifi ed Programmer for Java 6 Study Guide
    • if and switch Statements (Exam Objective 2.1) - if-else Branching - switch Statements - Exercise 5-1: Creating a switch-case Statement
    • Loops and Iterators (Exam Objective 2.2) - Using while Loops - Using do Loops - Using for Loops - Using break and continue - Unlabeled Statements - Labeled Statements - Exercise 5-2: Creating a Labeled while Loop
    • Handling Exceptions (Exam Objectives 2.4 and 2.5) - Catching an Exception Using try and catch - Using finally - Propagating Uncaught Exceptions - an Exception Exercise 5-3: Propagating and Catching - Defining Exceptions - Exception Hierarchy - Handling an Entire Class Hierarchy of Exceptions - Exception Matching - Exception Declaration and the Public Interface - Rethrowing the Same Exception - Exercise 5-4: Creating an Exception
    • Common Exceptions and Errors(Exam Objective 2.6)
    • Working with the Assertion Mechanism (Exam Objective 2.3) - Assertions Overview - Enabling Assertions - Using Assertions Appropriately
      • ✓ Two-Minute Drill
    • Q&A Self Test - Self Test Answers
  • 6 Strings, I/O, Formatting, and Parsing Contents xvii
    • String, StringBuilder, and StringBuffer (Exam Objective 3.1) - The String Class - Important Facts About Strings and Memory - Important Methods in the String Class - The StringBuffer and StringBuilder Classes - and StringBuilder Classes Important Methods in the StringBuffer
    • File Navigation and I/O (Exam Objective 3.2) - The java.io.Console Class
    • Serialization (Exam Objective 3.3)
    • Dates, Numbers, and Currency (Exam Objective 3.4) - Working with Dates, Numbers, and Currencies
    • Parsing, Tokenizing, and Formatting (Exam Objective 3.5) - A Search Tutorial - Locating Data via Pattern Matching - Tokenizing - Formatting with printf() and format()
      • ✓ Two-Minute Drill
    • Q&A Self Test - Self Test Answers
  • 7 Generics and Collections
    • Overriding hashCode() and equals() (Objective 6.2) - Overriding equals() - Overriding hashCode()
    • Collections (Exam Objective 6.1) - So What Do You Do with a Collection? - List Interface - Set Interface - Map Interface - Queue Interface
    • Using the Collections Framework (Objectives 6.3 and 6.5) - ArrayList Basics - Autoboxing with Collections - Sorting Collections and Arrays - Navigating (Searching) TreeSets and TreeMaps - Other Navigation Methods - Backed Collections
    • Generic Types (Objectives 6.3 and 6.4) xviii SCJP Sun Certifi ed Programmer for Java 6 Study Guide - Generics and Legacy Code - Mixing Generic and Non-generic Collections - Polymorphism and Generics - Generic Methods - Generic Declarations
      • ✓ Two-Minute Drill
    • Q&A Self Test - Self Test Answers
  • 8 Inner Classes
    • Inner Classes - Coding a "Regular" Inner Class - the Inner Class Referencing the Inner or Outer Instance from Within
    • Method-Local Inner Classes - What a Method-Local Inner Object Can and Can't Do
    • Anonymous Inner Classes - Plain-Old Anonymous Inner Classes, Flavor One - Plain-Old Anonymous Inner Classes, Flavor Two - Argument-Defined Anonymous Inner Classes
    • Static Nested Classes - Instantiating and Using Static Nested Classes
      • ✓ Two-Minute Drill
    • Q&A Self Test - Self Test Answers
  • 9 Threads
    • Defining, Instantiating, and Starting Threads (Objective 4.1) - Defining a Thread - Instantiating a Thread - Starting a Thread
    • Thread States and Transitions (Objective 4.2) - Thread States - Preventing Thread Execution - Sleeping - Putting It to Sleep Exercise 9-1: Creating a Thread and - Thread Priorities and yield( )