ebook img

A Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) PDF

2629 Pages·2016·51.798 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 A Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA)

About This E-Book EPUB is an open, industry-standard format for e-books. However, support for EPUB and its many features varies across reading devices and applications. Use your device or app settings to customize the presentation to your liking. Settings that you can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge. For additional information about the settings and features on your reading device or app, visit the device manufacturer’s Web site. Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the e-book in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a “Click here to view code image” link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the Back button on your device or app. ® A Programmer’s Guide to Java SE 8 Oracle Certified Associate (OCA) A Comprehensive Primer Khalid A. Mughal Rolf W. Rasmussen Boston • Columbus • Indianapolis • New York • San Francisco • Amsterdam • Cape Town Dubai • London • Madrid • Milan • Munich • Paris • Montreal • Toronto • Delhi • Mexico City São Paulo • Sydney • Hong Kong • Seoul • Singapore • Taipei • Tokyo Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at [email protected] or (800) 382-3419. For government sales inquiries, please contact [email protected]. For questions about sales outside the U.S., please contact [email protected]. Visit us on the Web: informit.com/aw Library of Congress Control Number: 2016937073 Copyright © 2017 Pearson Education, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request forms and the appropriate contacts within the Pearson Education Global Rights & Permissions Department, please visit www.pearsoned.com/permissions/. ISBN-13: 978-0-13-293021-5 ISBN-10: 0-13-293021-8 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana. First printing, July 2016 To the loving memory of my mother, Zubaida Begum, and my father, Mohammed Azim —K.A.M. For Olivia E. Rasmussen and Louise J. Dahlmo —R.W.R. Contents Overview Figures Tables Examples Foreword Preface 1 Basics of Java Programming 2 Language Fundamentals 3 Declarations 4 Access Control 5 Operators and Expressions 6 Control Flow 7 Object-Oriented Programming 8 Fundamental Classes 9 Object Lifetime 10 The ArrayList<E> Class and Lambda Expressions 11 Date and Time A Taking the Java SE 8 Programmer I Exam B Exam Topics: Java SE 8 Programmer I C Annotated Answers to Review Questions D Solutions to Programming Exercises E Mock Exam: Java SE 8 Programmer I F Annotated Answers to Mock Exam I Index Contents Figures Tables Examples Foreword Preface 1 Basics of Java Programming 1.1 Introduction 1.2 Classes Declaring Members: Fields and Methods 1.3 Objects Class Instantiation, Reference Values, and References Object Aliases 1.4 Instance Members Invoking Methods 1.5 Static Members 1.6 Inheritance 1.7 Associations: Aggregation and Composition 1.8 Tenets of Java Review Questions 1.9 Java Programs 1.10 Sample Java Application Essential Elements of a Java Application Compiling and Running an Application 1.11 Program Output Formatted Output 1.12 The Java Ecosystem Object-Oriented Paradigm Interpreted: The JVM Architecture-Neutral and Portable Bytecode Simplicity Dynamic and Distributed Robust and Secure High Performance and Multithreaded Review Questions Chapter Summary Programming Exercise 2 Language Fundamentals 2.1 Basic Language Elements Lexical Tokens Identifiers Keywords Separators Literals Integer Literals Floating-Point Literals Underscores in Numerical Literals Boolean Literals Character Literals String Literals Whitespace Comments Review Questions 2.2 Primitive Data Types The Integer Types The char Type The Floating-Point Types The boolean Type Review Questions 2.3 Variable Declarations Declaring and Initializing Variables Reference Variables 2.4 Initial Values for Variables Default Values for Fields Initializing Local Variables of Primitive Data Types Initializing Local Reference Variables Lifetime of Variables Review Questions Chapter Summary Programming Exercise 3 Declarations 3.1 Class Declarations 3.2 Method Declarations Statements Instance Methods and the Object Reference this Method Overloading 3.3 Constructors The Default Constructor Overloaded Constructors Review Questions 3.4 Arrays Declaring Array Variables Constructing an Array Initializing an Array Using an Array Anonymous Arrays Multidimensional Arrays Sorting Arrays Searching Arrays Review Questions 3.5 Parameter Passing Passing Primitive Data Values Passing Reference Values Passing Arrays Array Elements as Actual Parameters final Parameters 3.6 Variable Arity Methods Calling a Variable Arity Method Variable Arity and Fixed Arity Method Calls 3.7 The main() Method Program Arguments 3.8 Enumerated Types Declaring Type-safe Enums Using Type-safe Enums Selected Methods for Enum Types Review Questions Chapter Summary Programming Exercise 4 Access Control 4.1 Java Source File Structure 4.2 Packages Defining Packages Using Packages Compiling Code into Packages Running Code from Packages 4.3 Searching for Classes Review Questions 4.4 Scope Rules Class Scope for Members Block Scope for Local Variables 4.5 Accessibility Modifiers for Top-Level Type Declarations 4.6 Non-Accessibility Modifiers for Classes abstract Classes final Classes Review Questions 4.7 Member Accessibility Modifiers public Members

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.