ebook img

Oracle Certified Associate, Java SE 7 Programmer Study Guide PDF

332 Pages·2012·3.537 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Oracle Certified Associate, Java SE 7 Programmer Study Guide

www.it-ebooks.info Oracle Certified Associate, Java SE 7 Programmer Study Guide Comprehensive review of Oracle Certified Associate, Java SE 7 Programmer Certification objectives Richard M. Reese professional expertise distilled P U B L I S H I N G BIRMINGHAM - MUMBAI www.it-ebooks.info Oracle Certified Associate, Java SE 7 Programmer Study Guide Copyright © 2012 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: August 2012 Production Reference: 1160812 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84968-732-4 www.packtpub.com Cover Image by Mark Holland ([email protected]) www.it-ebooks.info Credits Author Project Coordinator Richard M. Reese Joel Goveya Reviewers Proofreader Edward E. Griebel Jr. Linda Morris Abraham Tehrani Indexer Hemangini Bari Acquisition Editor Dhwani Devater Graphics Manu Joseph Lead Technical Editor Susmita Panda Production Coordinator Nilesh R. Mohite Technical Editor Vrinda Amberkar Cover Work Nilesh R. Mohite www.it-ebooks.info About the Author Richard Reese is an Associate Professor for Computer Science at Tarleton State University in Stephenville, Texas. Previously, he has worked in the Aerospace and Telephony industries for over 17 years. He earned his Ph.D. in Computer Science from Texas A&M University and served 4 years in the Air Force primarily in the field of Communication Intelligence. Outside the classroom, he enjoys tending his vegetable garden, maintaining his aquariums and greenhouse, and playing with his dog, Zoey. He also enjoys reading a variety of technical and non-technical material. Richard has written numerous publications and wrote EJB 3.1 Cookbook and the Java 7 New Features Cookbook for Packt Publishing. No book can be written without the help of others. To this end I am thankful for the support of Karla, my wife, whose patience and reviews have made this effort possible. In addition, I would like to thank the editorial staff of Packt and the reviewers for their input which has resulted in a much better book than it might otherwise have been. www.it-ebooks.info About the Reviewers Edward E. Griebel Jr. was first introduced to computers in elementary school through LOGO on an Apple ][ and "The Oregon Trail" on a VAX. Pursuing his interest in computers, Ed graduated from Bucknell University with a degree in Computer Engineering. At his first job he quickly realized he didn't know everything that there was to know about Computer Programming. Ed has spent the past 20 years honing his skills in the securities trading, telecommunications, payroll processing, and machine-to-machine communications industries as a Developer, Team Lead, Consultant, and Mentor. Currently working on Enterprise Development in Java EE, Ed feels that any day spent writing code is a good day. Away from the keyboard, Ed enjoys road trips with his wife and three children, and playing Ultimate Frisbee and Xbox. He also volunteers as his sons' scout leader and on committees at his church. I would like to thank my wife and three children who are by now used to letting me sleep late after long nights at the computer. Abraham Tehrani has over a decade of experience in Software Development as a Developer and QA Engineer. He is passionate about quality and technology. I would like to thank my fiancé for her support and love. I would also like to thank my friends and family for supporting me in all of my endeavors. www.it-ebooks.info www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Instant Updates on New Packt Books Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page. www.it-ebooks.info Table of Contents Preface 1 Chapter 1: Getting Started with Java 7 Understanding Java as a technology 7 Object-oriented software development 8 OOP principles 10 Examining the types of Java applications 12 Exploring the structure of a Java console program 15 A simple Java application 15 Package 17 Import 17 The Customer class 18 Instance variables 18 Methods 18 The CustomerDriver class' main method 19 Exploring the structure of a class 19 Classes, interfaces, and objects 20 Classes and objects 20 Constructors 21 Interfaces 21 Methods 22 Method declaration 22 Method signature 23 The main method 24 Access modifiers 25 Documentation 26 Comments 27 Java naming conventions 28 Using Javadocs 28 Investigating the Java application development process 29 Compiling a Java application 30 SDK file structure 31 www.it-ebooks.info Table of Contents IDE file structure 31 Developing Java applications without an IDE 32 Java environment 33 Annotations 35 Java class libraries 35 Summary 36 Certification objectives covered 37 Test your knowledge 37 Chapter 2: Java Data Types and Their Usage 39 Understanding how Java handles data 40 Java identifiers, objects, and memory 40 Stack and heap 40 Declaring a variable 45 Primitive data types 46 Wrapper classes and autoboxing 48 Initializing identifiers 49 Java constants, literals, and enumerations 51 Literals 51 Constants 56 The final keyword 57 Enumerations 57 Immutable objects 58 Instance versus static data 58 Scope and lifetime 58 Scoping rules 59 Access modifiers 60 Data summary 61 Building expressions using operands and operators 61 Precedence and associativity 62 Casting 63 Working with characters and strings 64 The String, StringBuffer, and StringBuilder classes 64 Unicode characters 65 The Character class 66 The Character class – methods 66 The String class 66 String comparisons 68 Basic string methods 72 String length 73 Number/string conversions 73 Miscellaneous String methods 74 The StringBuffer and StringBuilder classes 74 Summary 75 [ ii ] www.it-ebooks.info Table of Contents Certification objectives covered 76 Test your knowledge 76 Chapter 3: Decision Constructs 79 Flow of control 80 Control statement – an overview 80 Logical expressions 81 Boolean variables 81 The equality operator 82 Relational operators 82 Logical operators 83 Short circuit evaluation 85 Using the && operator 85 Using the || operator 86 Avoiding short circuit evaluation 86 The if statement 87 Nested if statements 90 The else-if variation 91 The if statement – usage issues 92 Misusing the equality operator 92 Using inverse operations 93 Using Boolean variables instead of logical expressions 94 Using true or false in a logical expression 95 The perils of not using the block statement 96 The dangling else problem 97 Conditional operator 99 The switch statement 100 Integer-based switch statements 101 Enumeration-based switch statements 103 String-based switch statements 104 String issues with the switch statement 105 Control structure issues 105 General decision constructs issues 105 Floating point number considerations 106 Special floating point values 107 Comparing floating point numbers 109 Rounding errors 110 The strictfp keyword 111 Comparing objects 111 Three basic coding activities 112 The goto statement 112 Summary 113 Certification objectives covered 114 Test your knowledge 114 [ iii ] www.it-ebooks.info

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.