ebook img

Java 7 Pocket Guide, 2nd Edition: Instant Help for Java Programmers PDF

215 Pages·2013·87.37 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 Java 7 Pocket Guide, 2nd Edition: Instant Help for Java Programmers

www.it-ebooks.info www.it-ebooks.info SECOND EDITION Java 7 Pocket Guide > m o c k. o o b e w o w w. w w < k o o B e w! o W m o d fr a o nl Robert Liguori and Patricia Liguori w o D www.it-ebooks.info Java 7 Pocket Guide, Second Edition by Robert Liguori and Patricia Liguori Copyright © 2013 Gliesian, LLC. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebasto‐ pol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribookson line.com). For more information, contact our corporate/institutional sales de‐ partment: 800-998-9938 or [email protected]. Editors: Mike Loukides and Meghan Blanchette Production Editor: Rachel Steely Copyeditor: Jasmine Kwityn Proofreader: Charles Roumeliotis Indexer: Ellen Troutman Cover Designer: Randy Comer Interior Designer: David Futato Illustrator: Rebecca Demarest July 2013: Second Edition Revision History for the Second Edition: 2013-07-03: First release See http://oreilly.com/catalog/errata.csp?isbn=9781449343569 for release de‐ tails. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. The Pocket Guide series designa‐ tions, Java 7 Pocket Guide, the image of a Javan tiger, and related trade dress are trademarks of O’Reilly Media, Inc. 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 O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 978-1-449-34356-9 [M] www.it-ebooks.info This book is dedicated to our beautiful, awesome-tastic daughter, Ashleigh. www.it-ebooks.info www.it-ebooks.info Table of Contents Preface xi Part I. Language Chapter 1: Naming Conventions 3 Class Names 3 Interface Names 3 Method Names 4 Instance and Static Variable Names 4 Parameter and Local Variable Names 4 Generic Type Parameter Names 4 Constant Names 5 Enumeration Names 5 Package Names 5 Acronyms 6 Chapter 2: Lexical Elements 7 Unicode and ASCII 7 Comments 9 Keywords 10 v www.it-ebooks.info Identifiers 11 Separators 12 Operators 12 Literals 13 Escape Sequences 16 Unicode Currency Symbols 17 Chapter 3: Fundamental Types 19 Primitive Types 19 Literals for Primitive Types 20 Floating-Point Entities 21 Numeric Promotion of Primitive Types 24 Wrapper Classes 25 Autoboxing and Unboxing 26 Chapter 4: Reference Types 29 Comparing Reference Types to Primitive Types 30 Default Values 30 Conversion of Reference Types 32 Converting Between Primitives and Reference Types 33 Passing Reference Types into Methods 33 Comparing Reference Types 35 Copying Reference Types 38 Memory Allocation and Garbage Collection of Reference Types 39 Chapter 5: Object-Oriented Programming 41 Classes and Objects 41 Variable-Length Argument Lists 47 Abstract Classes and Abstract Methods 49 Static Data Members, Static Methods, Static Constants, and Static Initializers 50 vi | Table of Contents www.it-ebooks.info Interfaces 51 Enumerations 52 Annotation Types 53 Chapter 6: Statements and Blocks 55 Expression Statements 55 Empty Statement 56 Blocks 56 Conditional Statements 56 Iteration Statements 58 Transfer of Control 60 Synchronized Statement 62 Assert Statement 62 Exception Handling Statements 63 Chapter 7: Exception Handling 65 The Exception Hierarchy 65 Checked/Unchecked Exceptions and Errors 66 Common Checked/Unchecked Exceptions and Errors 67 Exception Handling Keywords 69 The Exception Handling Process 74 Defining Your Own Exception Class 75 Printing Information About Exceptions 75 Chapter 8: Java Modifiers 79 Access Modifiers 80 Other (Nonaccess) Modifiers 81 Part II. Platform Chapter 9: Java Platform, SE 85 Table of Contents | vii www.it-ebooks.info Common Java SE API Libraries 86 Chapter 10: Development Basics 99 Java Runtime Environment 99 Java Development Kit 99 Java Program Structure 100 Command-Line Tools 102 Classpath 109 Chapter 11: Memory Management 111 Garbage Collectors 111 Memory Management Tools 113 Command-Line Options 114 Resizing the JVM Heap 117 Interfacing with the GC 117 Chapter 12: Basic Input and Output 119 Standard Streams in, out, and err 119 Class Hierarchy for Basic Input and Output 120 File Reading and Writing 121 Socket Reading and Writing 123 Serialization 124 Zipping and Unzipping Files 126 File and Directory Handling 127 Chapter 13: NIO 2.0 Quicklook 129 The Path Interface 129 The Files Class 130 Additional Features 131 Chapter 14: Concurrency 133 Creating Threads 133 viii | Table of Contents 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.