Head Frist java By Kathy Sierra & Bert Bates
Chapter1:Breaking the Surface:
a quick dip:
The way Java works
Code structure in Java
Anatomy of a class
The main() method
Looping
Conditional branching
Coding the "99 bottles of beer"app
Phrase-o-matic
Fireside chat:compiler vs.JVM
Chapter2:A Trip to Objectville:
yes, there will be objects:
Chair Wars
Inheritance
Overriding methods
What's in a class?
Making your first object
Using main()
chapter3:Know Your Variables:
primitives and references:
Declaring a variable
Primitive types
Java keywords
Reference variables
Object declaration and assignment
Objects on the garbage-collection heap
Arrays
Chapter4:How Objects Behave:
object state affects method behavior:
Methods use object state
Method arguments and return types
Pass-by-value
Getters and Setters
Encapsulation
Using references in an array
Chapter5:Extra-Strength Methods:
flow control,operations,and more:
Building the Sink a Dot Com game
Starting with the Simple Dot Com game
Writing prepcode
Test code for Simple Dot Com
Coding the Simple Dot Com game
Final code for Simple Dot Com
Generating random numbers with Math.random()
Ready-bake code for getting user input from the command-line
Looping with for loops
Casting primitives from a large size to a smaller size
Converting a String to an int with Integer.parseInt()
Chapter6:Using the Java Library:
so you don't have to write it all yourself:
Analying the bug in the Simple Dot Com Game
Array List
Fixing the DotCom class code
Building the real game
Prepcode for the real game
Code for the real game
boolean expressions
Using the library
Using packages
Using the HTML API docs and reference books
Chapter7:Better Living in Objectville:
planning for the future:
Understanding inheritance
Designing an inheritance tree
Avoiding duplicate code
Overriding methods
IS-A and HAS-A
What do you inherit from your superclass?
What does inheritance really buy you?
Polymorphism
Rules for overriding
Method overloading
Chapter8:Serious Polymorphism:
exploiting abstract classes and interfaces:
Some classes just should not be instantiated
Abstract classes
Abstract methods
Polymorphism in action
Class Object
Taking objects out of an Array List
Compiler checks the reference type
Get in touch with inner object
Polymorphic references
Casting an object reference
Deadly Diamond of Death
Using interfaces
Chapter9:Life and Death of an Object:
constructors and memory management:
The stack and the heap,where objects and variables live
Methods on the stack
Where local variables live
Where instance variables live
The miracle of object creation
Constructors
Initializing the state of a new Duck
Overloaded Constructors
Superclass Constructors
Invoking Overloaded Constructors using this()
Life of an object
Garbage Collection
Chapter10:Numbers Matter:
math,formating,wrappers,and statics:
Math class
static methods
static variables
Constants
Math methods
Wrapper classes
Autoboxing
Number formatting
Date formatting and manipulation
Static imports
Chapter11:Risky Behavior:
exception handling:
Making a music machine
What if you need to call risky code?
Exceptions say"something bad may have happened...."
The compiler guarantees
Catching Exceptions using a try/catch
Flow control in try/catch blocks
The finally block
Catching multiple Exceptions
Declaring an Exception
Handle or declare law
Code Kitchen
Chapter12:A Very Graphic Story:
into to GUI,event handling,and inner classes:
You first GUI
Getting a user event
Implement a listener interface
Getting a button's ActionEvent
Putting graphics on a GUI
Fun with paintComponent()
The Graphics2D object
Putting more than one button on a screen
Inner classes to the rescue
Animation
Code Kitchen
Chapter13:Work on Your Swing:
layout managers and components:
Swing Components
Layout Managers
Three Layout Managers
BorderLayout
Flow Layout
Box Layout
JTextField
JTextArea
JCheckBox
JList
Chapter14:Saving Objects:
serialization and I/O:
Saving object state
Writing a serialized object to a file
Java input and output streams
object serialization
Implementing the serializable interface
Using transient variables
Deserializing an object
Writing to a text file
java.io.File
Reading from a text file
Splitting a String into tokens with split()
Chapter15:Make a Connection:
networking sockets and multithreading:
Chat program overview
Connecting,sending,and receiving
Network sockets
TCP ports
Reading data from a socket
Writing data to a socket
Writing the Daily Advice Client program
Writing a simple server
Daily Advice server code
Writing a chat client
Multiple call stacks
Launching a new thread
The Runnable interface
Three states of a new thread object
The Runnable-running loop
Thread scheduler
Putting a Thread to sleep
Making and starting two Threads
Concurrency issues:can this couple be saved?
the Ryan and Monica Concurrency problem,in code
Locking to make things atomic
Every object has a lock
The dreaded "Lost Update " problem
Synchronized methods
Deadlock!
Multithreaded chat client code
Ready-bake SimpleChatServer
Chapter16:Data Structures:
collections and generics:
Collections
Sorting an ArrayList with Collections.sort()
Generics and type-safety
Sorting things that implement the Comparable interface
Sorting things with a custom Comparator
The Collection API---- lists,sets,and maps
Avoiding duplicates with HashSet
Overriding hashCode()and equals()
HashMap
Using wildcards for polymorphism
Chapter17:Release Your Code:
packaging and deployment:
Deployment options
Keep your source code and class files separate
Making an executable JAR
Running an executable JAR
Put your classes in a package!
Packages must have a matching directory structure
Compiling and running with packages
Compiling with-d
Making an executable JAR
Java Web Start (JWS) for deployment from the web
How to make and deploy a JWS application
Chapter18:Distributed Computing:
RMI with a dash of servlets,EjB,and Jini:
Java Remote Method Invocation(RMI),hands-on,very detailed
Servlets
Enterprise JavaBeans(EJB),a very quick look
Jini, the best trick of all
Building the really cool universal service browser.Download