1.
INTRODUCTION
a. What is Java
Java is an object-oriented programming language developed by Sun
Microsystems, a company best known for its high-end Unix
workstations. the Java language was designed to be small, simple, and
portable across platforms and operating systems, both at the source
and at the binary level.
The Java language was developed at Sun Microsystems in 1991 as part
of a research project to develop software for consumer electronics
devicestelevision sets, VCRs, toasters, and the other sorts of
machines you can buy at any department store. Javas goals at that
time were to be small, fast, efficient, and easily portable to a wide
range of hardware devices. It is those same goals that made Java an
ideal language for distributing executable programs via the World Wide
Web, and also a general-purpose programming language for
developing programs that are easily usable and portable across
different platforms.
The Java development environment has two parts: a Java compiler and
a Java interpreter. The Java compiler takes your Java program and
instead of generating machine codes from your source files, it
generates bytecodes.
To run a Java program, you run a program called a bytecode
interpreter, which in turn executes your Java program (see Figure 1.3).
You can either run the interpreter by itself, orfor appletsthere is a
bytecode interpreter built into HotJava and other Java-capable
browsers that runs the applet for you.
Why go through all the trouble of adding this extra layer of the
bytecode interpreter? Having your Java programs in bytecode form
means that instead of being specific to any one system, your programs
can be run on any platform and any operating or window system as
long as the Java interpreter is available. This capability of a single
binary file to be executable across platforms is crucial to what enables
applets to work, because the World Wide Web itself is also platform
independent.
Just as HTML files can be read on any platform, so applets can be
executed on any
platform that is a Java-capable browser.
b. Getting started with java
X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
2. OOPS
a. Objects and Classes
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Behavior and Attributes
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Inheritance, Interfaces and Packages
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Creating a subclass
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
3. JAVA BASICS
a. Statements and Expressions
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Variables and Data Types
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Comments
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Literals
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
e. Expressions and Operators
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
f. String Arithmatic
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
4. WORKING WITH OBJECTS
a. Creating new objects
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Accessing and Setting Class and Instance Variables
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Calling Methods
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. References to Objects
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
e. Casting and Converting Objects and Primitive types
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
f. Odds and Ends
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
g. The Java Class Libraries
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
5. ARRAYS, CONDITIONALS AND LOOPS
a. Arrays
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Block Statements
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Breaking Out of Loops
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
6. CREATING CLASSES AND APPLICATIONS IN
JAVA
a. Defining Classes
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Creating Instance and Class Variables
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Creating Methods
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Creating Java Applications
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
e. Java Applications and Command Line Arguments
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
7. MORE ABOUT METHODS
a. Creating Methods with Same Name and Different Arguments
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Constructor Methods
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Overriding Methods
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Finalizer Methods
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
8. JAVA APPLET BASICS
a. How Applets and Applications are different
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Creating Applets
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Including an Applet on a Webpage
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. More about the <Applet> tag
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
e. Pasting Parameters to the Applet
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
9. GRAPHICS, FONTS AND COLOR
a. The Graphics Class
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Drawing and Filling
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Text and Fonts
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Color
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
10.
SIMPLE ANIMATION AND THREADS
a. Creating Animation in Java
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Threads : What they are and why you need them
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Reducing Animation Flicker
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
11.
MORE ANIMATION, IMAGES AND SOUND
a. Retrieving and using images
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Creating Animation using images
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Retrieving and Using Sounds
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Suns Animator Applet
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
e. More about Flicker : Double Buffering
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
12.
MANAGING SIMPLE EVENTS AND
INTERACTIVITY
a. Mouse Clicks
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Mouse Movements
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Keyboard Events
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. The AWT Event Handler
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
13.
THE JAVA ABSTRACT WINDOWING
TOOLKIT
a. An AWT Overview
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. The Basic User Interface Components
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Panels and Layout
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Handling UI Actions and Events
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
e. Nesting Panels and Components
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
f. More UI Components
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
g. More UI Events
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
h. A complete Example
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
14.
WINDOWS, NETWORKING AND OTHER TIDBITS
a. Windows, Menus and Dialog Boxes
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Networking in Java
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Other Applet Hints
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
15.
MODIFIERS
a. Method and Variable Access Control
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Class Variables and Methods
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. The final Modifier
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Abstract Methods and Classes
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
16.
PACKAGES AND INTERFACES
a. Packages
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Interfaces
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
17.
EXCEPTIONS
a. Programming in the Large
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Programming in the Small
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. The Limitations Placed on the Programmer
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. The finally Clause
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
18.
MULTITHREADING
a. The Problem with Parallelism
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Thinking Multithreaded
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Creating and Using Threads
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. Knowing When a Thread has stopped
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
e. Thread Scheduling
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
19.
STREAMS
a. Input Streams
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Output Streams
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Related Classes
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
20.
NATIVE METHODS AND LIBRARIES
a. Disadvantages of Native methods
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. Illusion of Required Efficiency
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Writing native Methods
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. A native Library
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
21.
UNDER THE HOOD
a. The Big Picture
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. The Java Virtual Machine
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
c. Bytecodes in More Detail
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
d. The .class File Format
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
e. Method Signatures
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
a. The Garbage Collector
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx
b. The Security Story
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxx