Docstoc

JavaCore Table Of Contents

Document Sample
JavaCore Table Of Contents Powered By Docstoc
					Table of Contents
Chapter1: Getting Started
The Java Programming Language …………………………………………………….. Java Platform …………………………………………………………………………….. What Can Java Technology Do? ……………………………………………………….

Page No

1 2 3

Creating Your First Application …………………………………………………………. 4

Chapter2: Learning the Java Language
Object-Oriented Programming Concepts ……………………………………………… 14 What Is an Object? …………………………………………………………………........ What Is a Class? …………………………………………………………………………. What Is an Inheritance? ……………………………………………………………........ What Is an Interface?…………………………………………………………………….. What Is a Package? ……………………………………………………………………... Variables and Primitive Data Type …………………………………………………….. Arrays ……………………………………………………………………………………... Operators …………………………………………………………………………………. Expressions, Statements, and Blocks …………………………………………………. Control Flow Statements ………………………………………………………………... 15 17 19 20 21 23 26 32 41 43

Chapter 3: Classes and Objects
Classes ……………………………………………………………………………………. Access Modifiers …………………………………………………………………………. Defining Methods ………………………………………………………………………… Overloading Methods ……………………………………………………………………. Providing Constructors for Your Classes ……………………………………………… Parameter Types and Names ………………………………………………………….. Objects ……………………………………………………………………………………. Creating Objects …………………………………………………………………………. Referencing an Object's Fields ………………………………………………………… Calling an Object's Methods ……………………………………………………………. The Garbage Collector ………………………………………………………………….. 57 61 63 64 65 68 70 71 77 78 79

More on Classes …………………………………………………………………………. Class Methods ………………………………………………………………………….... Constants …………………………………………………………………………………. Static Initialization Blocks………………………………………………………………... Nested Classes …………………………………………………………………………... Inner Classes …………………………………………………………………………….. Enum Types ……………………………………………………………………………....

80 87 88 90 92 93 98

Chapter 4: Interfaces and Inheritance
Interfaces in Java ………………………………………………………………………… 103 Interfaces and Multiple Inheritance …………………………………………………….. 105 Implementing an Interface ………………………………………………………………. 106 Using an Interface as a Type …………………………………………………………… Inheritance ………………………………………………………………………………... An Example of Inheritance ……………………………………………………………… Casting Objects ………………………………………………………………………….. Overriding and Hiding Methods ………………………………………………………… The finalize() Method and Writing Final Classes and Methods …………………….. Abstract Methods and Classes …………………………………………………………. When an Abstract Class Implements an Interface ……………………………........... 108 110 111 114 115

Using the Keyword super - Accessing Superclass Members ……………………….. 117 119 120 123

Chapter 5: Strings
Characters ………………………………………………………………………………... Strings …………………………………………………………………………………….. String Length …………………………………………………………………………….. Concatenating Strings …………………………………………………………... Creating Format Strings ………………………………………………………………… Converting Strings to Numbers ………………………………………………………… Converting Numbers to Strings ………………………………………………………… Getting Characters and Substrings by Index …………………………………………. Replacing Characters and Substrings into a String ………………………………….. Comparing Strings and Portions of Strings …………………………………………… 124 126 127 128 130 130 131 133

Searching for Characters and Substrings in a String ………………………………… 135 136 138

The StringBuilder Class ………………………………………………………………….

140

StringBuilder Operations ………………………………………………………………… 142

Chapter 6: Packages
Creating and Using Packages …………………………………………………………. Naming Conventions ……………………………………………………………………. Referring to a Package Member by Its Qualified Name …………………………….. Importing a Package Member ………………………………………………………….. Importing an Entire Package …………………………………………………………… Managing Source and Class Files ……………………………………………………... Setting the CLASSPATH System Variable ……………………………………………. 146 149 150 150 151 152 154

Chapter 7: Exceptions
What Is an Exception? ………………………………………………………………….. The Catch or Specify Requirement ……………………………………………………. The Three Kinds of Exceptions ………………………………………………………… Catching and Handling Exceptions ……………………………………………………. The catch Blocks ………………………………………………………………………… The finally Block ………………………………………………………………………….. How to Throw Exceptions ………………………………………………………………. The throw Statement …………………………………………………………………….. Error class and Exception Class ……………………………………………………….. 155 157 157 159

The try Block ……………………………………………………………………………… 160 161 163 165 166 167

Chapter 8: Basic I/O
I/O Streams ………………………………………………………………………………. Byte Streams …………………………………………………………………………….. Character Streams ………………………………………………………………………. Line-Oriented Streams ………………………………………………………………….. Buffered Streams ………………………………………………………………………… Scanning ………………………………………………………………………………….. Formatting ………………………………………………………………………………… Standard Streams and Data Streams …………………………………………………. Object Streams …………………………………………………………………………... 169 171 173 175 176 178 180 184 187

File I/O – File Objects ………………………………………………………………….... Random Access File ……………………………………………………………………..

189 191

Chapter 9: Concurrency
Processes and Threads …………………………………………………………………. Thread Objects …………………………………………………………………………… Pausing Execution with Sleep ………………………………………………………….. Interrupts ………………………………………………………………………………….. Joins........................................................................................................................ The SimpleThreads Example …………………………………………………………... Synchronization ………………………………………………………………………….. Synchronized Methods ………………………………………………………………….. Synchronized Statements ………………………………………………………………. Atomic Access, Liveness and Deadlock …………………………………………… Immutable Objects ………………………………………………………………………. A Synchronized Class Example ……………………………………………………….. 194 196 197 198 200 201 203 205 206 208 210 210

Chapter 10: Generics
Introduction ………………………………………………………………………………. Defining Simple Generics ………………………………………………………………. Generics and Subtyping ………………………………………………………………… Wildcards …………………………………………………………………………………. Bounded Wildcards …………………………………………………………………….... Generic Methods ……………………………………………………………………….... 213 214 216 216 218 221