Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
2Activity

Table Of Contents

CHAPTER 1: INTRODUCTION TO JAVA
Prerequisites
Getting Started
Types of Java Applications
Java Console Application
Figure 1.1: A Console Application
Java GUI Application
Figure 1.2: Java GUI Application
Java Applet
Figure 1.3: A Java Applet
Figure 1.4: A Java Application Running on Windows
Cross Platform
Figure 1.5: A Java Application Running on the Macintosh
Chapter Review
Review Questions
CHAPTER 2: INSTALLING, COMPILING AND RUNNING
Downloading Java and Installing Java
Figure 2.1: Select Java Version to Download
Figure 2.2: Accept the License Agreement
Figure 2.3: Choose Windows Online Install
Figure 2.4: Run the Program you Downloaded
Figure 2.5: Accept this License Agreement
Figure 2.6: Standard Install
Figure 2.8: Accept Features
Figure 2.9: Browser Registration
Figure 2.10: Installing Java
Figure 2.11: Install Complete
Setting up Java’s Path
Figure 2.12: Get the Java Path
Figure 2.13: Windows XP Control Panels
Figure 2.14: Classic Control Panels
Figure 2.15: System Properties
Figure 2.16: Environmental Variables
Figure 2.17: Set the Path
Testing your Java Path
Figure 2.18: Verify Java Works
Compiling and Executing your Application
Creating a Directory
Figure 2.19: Create a Place to Put your First Application
Enter your Application
Figure 2.20: Create your Source Code
Listing 2.1: Hello World! (HelloWorld.java)
Compile your Application
Figure 2.22: View the Class File
Run your Application
Figure 2.23: Run the Example
CHAPTER 3: VARIABLES
Anatomy of a Java Program
Listing 3.1: Sample Java Program (UserInput.java)
Import Statements
Single Line Comments
Multi Line Comments
Class Declaration
Main Method
Semicolon and Curly Brace Usage
Figure 3.1: How indenting works
Variables
Table 3.1: Java Variable Types
meric data types
Numeric Data Types
Data Type Conversion
CHAPTER 4: HANDLING USER INPUT
How to Read Data from the User
Listing 4.1: Read Data from the User (Hello.java)
Additional Lines Needed
Reading Numbers
Listing 4.2: Input Numbers (InputNumbers.java)
Handling Bad Numbers
Listing 4.3: Handle Bad Numbers (BadNumbers.java)
Displaying Data
CHAPTER 5: MAKING DECISIONS
Comparing Values
Listing 5.1: Are You Old Enough (OldEnough.java)
Listing 5.2: Compare a String (InvalidString.java)
Listing 5.3: Check for a Valid String (ValidString.java)
The Else Statement
Listing 5.4: Else Example (StringElse.java)
If/Else Ladders
Listing 5.5: If/Else Ladder (NumberIf.java)
Using Logical AND and OR
Table 5.1: Truth Table for x && y (AND)
Table 5.2: Truth Table for x || y (OR)
Using the Switch/Case Statement
Listing 5.6: Using Switch/Case (NumberCase.java)
CHAPTER 6: METHODS AND FUNCTIONS
Static Variables
Listing 6.1: Using a Static Variable (MyClassStatic.java)
Listing 6.2: Using a Static Class Variable (MyClassLevelStatic.java)
Instance Variables
Listing 6.3: Using an Instance Variable (MyClassInstance.java)
Local Variables
Listing 6.4: Using an Instance Variable (MyClassLocal.java)
Functions and Methods
Create Your Own Function
Table 6.1: Sections of a Method
Table 6.2: The Difference Between a Class and an Object
Listing 6.5: Using a Static Function (MyClassStaticFunction.java)
Listing 6.6: Using a Nonstatic Method (MyClassNonStaticMethod.java)
Using Static Classes
How Arguments are Passed
Listing 6.7: Passing by Value (MyClassArgument.java)
Table 6.3: The Difference Between by Reference and by Value
Table 6.4: Is it by Value or by Reference
Listing 6.8: By Value and By Reference (MethodCall.java)
CHAPTER 7: MID TERM
CHAPTER 8: MID TERM REVIEW
CHAPTER 9: USING LOOPS
Table 9.1: Steps for a Typical Loop Application
Figure 9.1: The Loop as a Flowchart
Java Loop Types
The While Loop
Listing 9.1: A Typical While Loop (LoopExampleWhile.java)
The Do/While Loop
Listing 9.2: A While Loop (LoopExampleWhile2.java)
Figure 9.2: A While Loop as a Flowchart
Figure 9.3: A “do/while” Loop as a Flowchart
Listing 9.3: A Do/While Loop (LoopExampleDoWhile.java)
Listing 9.4: A Simple Menu (LoopExampleMenu.java)
The For Loop
Listing 9.5: For Loop (LoopExampleFor.java)
Listing 9.6: Another For Loop (LoopExampleFor2.java)
Nested Loops
Listing 9.7: A Nested Loop (NestedLoop.java)
Listing 10.2: Get a String as Characters (GetChars.java)
Taking Sections of Strings
Listing 10.3: Separate a String (SubString.java)
Searching Strings
Listing 10.4: Find the Space in a String (FindSpace1.java)
Listing 10.5: Find More Space in a String (FindSpace2.java)
Removing a Single Character
Listing 10.6: Remove a Single Character (RemoveChar.java)
Removing all of the Spaces from a String
Listing 10.7: Remove all Space from a String (RemoveSpace.java)
CHAPTER 11: ARRAYS
Listing 11.1: A List Without Arrays (StudentList1.java)
Introducing Arrays
Creating Arrays
Declare an Array
Listing 11.2: Declare an Array (StudentList2.java)
Declare an array
Instantiate an Array
Listing 11.3: Instantiate an Array (StudentList3.java)
Initializing an Array
Listing 11.4: Initialize an Array (StudentList4.java)
Instantiate an array
Using Arrays
Listing 11.5: Print out a List of Students (StudentList5.java)
Listing 11.6: List Students with Loop (StudentList6.java)
Array Example Program
Listing 11.7: Array Example Program (StudentList7.java)
Listing 11.8: Reading User Input
Deleting a Student
Figure 11.1: Remove a Name, Step 1
Figure 11.3: Remove a Name, Step 3
Figure 11.4: Remove a Name, Step 4
Figure 11.5: Remove a Name, Step 5
Figure 11.6: Remove a Name, Step 6
CHAPTER 12: USING ARRAYS
Sorting Arrays
Figure 12.1: A Glass of Milk and a Glass of Orange Juice
Figure 12.2: This Does Not Work!
Figure 12.3: A Spare Glass is Needed
Figure 12.4: The Swap is Made
Implementing the Bubble Sort
Figure 12.5: A Bubblesort Flowchart
Listing 12.1: The Bubble Sort (BubbleSort.java)
Adding Sorting to the Student List Example
Listing 12.2: The Student List, with Bubble Sort (StudentList.java)
CHAPTER 13: OBJECT ORIENTED PROGRAMMING
Objects of Your Own
Access Modifiers
Table 13.1: Java Access Modifiers
Creating the Base Class
Listing 13.1: A Simple Person Holder Class (Person1.java)
Getters and Setters
Listing 13.2: Using Getters and Setters (Person.java)
Using Objects
Listing 13.3: Test the Person Class (TestPerson.java)
Subclassing Classes
Creating an Exception Class
Listing 13.4: The TypeException (TypeException.java)
Creating the Student Class
Listing 13.5: The Student Class (Student.java)
Using Subclasses
Listing 13.6: Test the Student Class (TestStudent.java)
Understanding Interfaces
Listing 13.7: The Payable interface (Payable.java)
Listing 13.8: The Policy Base Class (Policy.java)
Table 13.2: Attributes of the Policy Class
Listing 13.9: The TermLife Class (TermLife.java)
Table 13.3: Attributes of the TermLife Class
Listing 13.10: The WholeLife Class (WholeLife.java)
Listing 13.11: The insurance Application (InsuranceApp.java)
CHAPTER 14: MORE OBJECT ORIENTED
Updating the Student Class
Listing 14.1: The Person Base Class (Person.java)
Listing 14.2: Creating the Student Class (Student2.java)
Listing 14.3: The Final Version of the Student Class (Student.java)
Integrating the Student Class
Listing 14.3: Creating a Student List (StudentList.java)
CHAPTER 15: GUI PROGRAMMING
Java GUI Applications
What is Swing
Figure 15.1: A Swing Application
Using Swing
Using Message Dialog Boxes
Figure 15.2: A Message Dialog Box
Listing 15.1: Creating a Message Dialog Box (MessageDialog.java)
Using Confirm Dialog Boxes
Figure 15.3: A Confirm Dialog Box
Listing 15.2: A Confirm Dialog Box (ConfirmDialog.java)
Using Input Dialogs
Figure 15.4: An Input Dialog Box
Listing 15.3: An input Dialog Box (InputDialog.java)
Using Option Dialog Boxes
Listing 15.4: An Option Dialog (OptionDialog.java)
CHAPTER 16: FINAL EXAM
GLOSSARY
APPENDIX A: DOWNLOADING EXAMPLES
APPENDIX B: FINAL EXAM ANSWERS
APPENDIX C: CHAPTER REVIEW ANSWERS
Answers for Chapter 1
Answers for Chapter 2
Answers for Chapter 3
Answers for Chapter 4
Answers for Chapter 5
Answers for Chapter 6
Answers for Chapter 9
Answers for Chapter 10
Answers for Chapter 11
Answers for Chapter 12
Answers for Chapter 13
Answers for Chapter 14
Answers for Chapter 15
INDEX
0 of .
Results for:
No results containing your search query
P. 1
Jeff Heaton - Java for the Beginning Programmer + Examples - 2009

Jeff Heaton - Java for the Beginning Programmer + Examples - 2009

Ratings: (0)|Views: 78|Likes:
Published by Uppu Stunty

More info:

Published by: Uppu Stunty on Jun 04, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

09/15/2011

pdf

text

original

You're Reading a Free Preview
Pages 7 to 78 are not shown in this preview.
You're Reading a Free Preview
Pages 85 to 136 are not shown in this preview.
You're Reading a Free Preview
Pages 143 to 168 are not shown in this preview.
You're Reading a Free Preview
Pages 175 to 280 are not shown in this preview.
You're Reading a Free Preview
Pages 287 to 334 are not shown in this preview.

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->