e7ba5a77-b72c-4b77-8da5-4b13a16e1c0f

Beginning Java

Table of Contents

1. Introducing Java

  • Preview 1-1
  • What is Java? 1-2
  • Why Learn Java? 1-4
  • A Brief History of Programming Languages 1-5
  • Let’s Get Started 1-7
  • Downloading and Installing Java 1-9
  • NetBeans – A Java Development Environment 1-14
  • Starting NetBeans 1-21
  • Opening a Java Project 1-23
  • Compiling and Running a Java Project 1-25
  • Stopping NetBeans 1-29
  • Summary 1-30

2. Java Program Basics

  • Review and Preview 2-1
  • Structure of a Java Program 2-2
  • The Welcome Project (Revisited) 2-4
  • Some Rules of Java Programming 2-7
  • Creating Java Projects with NetBeans 2-9
  • Saving Java Projects with NetBeans 2-15
  • Compiling and Running a Java Program 2-16
  • NetBeans and Java Files 2-18
  • Opening a Java Project 1-23
  • Summary 2-20

3. Your First Java Program

  • Review and Preview 3-1
  • Creating a Java Program 3-2
  • Java – The First Lesson 3-6
  • Variables 3-6
  • Variable Names 3-7
  • Variable Types 3-8
  • Declaring Variables 3-10
  • Assignment Statement 3-12
  • Arithmetic Operators 3-13
  • String Concatenation 3-17
  • Comments 3-18
  • Program Output 3-19
  • Project – Sub Sandwich Party 3-22
  • Project Design 3-22
  • Project Development 3-23
  • Run the Project 3-28
  • Other Things to Try 3-29
  • Summary 3-30

4. Java Project Design, Input Methods

  • Review and Preview 4-1
  • Project Design 4-2
  • Java – The Second Lesson 4-4
  • Variable Initialization 4-4
  • Mathematical Functions 4-6
  • Program Input Methods 4-10
  • Input Methods Example 4-12
  • Project – Savings Calculator 4-21
  • Project Design 4-21
  • Project Development 4-22
  • Run the Project 4-25
  • Other Things to Try 4-27
  • Summary 4-28

5. Debugging, Decisions, Random Numbers

  • Review and Preview 5-1
  • Debugging a Java Project 5-2
  • Syntax Errors 5-3
  • Run-Time Errors 5-6
  • Logic Errors 5-8
  • Java – The Third Lesson 5-9
  • Logical Expressions 5-9
  • Comparison Operators 5-10
  • Comparing Strings 5-12
  • Logical Operators 5-14
  • Decisions – The if Statement 5-19
  • Random Number Generator 5-25
  • Project – Guess the Number Game 5-29
  • Project Design 5-29
  • Project Development 5-30
  • Run the Project 5-33
  • Other Things to Try 5-34
  • Summary 5-36

6. Java Looping, Methods

  • Review and Preview 6-1
  • Java – The Fourth Lesson 6-2
  • Java Loops 6-2
  • A Brief Interlude – Guess the Number Game (Revisited) 6-8
  • Java – The Fourth Lesson (Continued) 6-11
  • Java Methods 6-11
  • Project – Lemonade Stand 6-17
  • Project Design 6-18
  • Project Development 6-19
  • Run the Project 6-26
  • Other Things to Try 6-28
  • Summary 6-29

7. Arrays, More Java Looping

  • Review and Preview 7-1
  • Java – The Fifth Lesson 7-2
  • Variable Arrays 7-2
  • Java for Loops 7-5
  • “Shuffle” Method 7-11
  • Project – Card Wars 7-18
  • Project Design 7-18
  • Project Development 7-19
  • Run the Project 7-29
  • Other Things to Try 7-30
  • Summary 7-31

8. Java Graphics, Mouse Methods

  • Review and Preview 8-1
  • Graphic User Interfaces (GUI) 8-2
  • Java Graphics 8-7
  • Frames 8-7
  • Event Methods 8-10
  • Graphics Coordinates 8-12
  • Colors 8-13
  • drawLine Method 8-16
  • drawRect Method 8-20
  • fillRect Method 8-22
  • Graphics Review 8-24
  • Java – The Sixth Lesson 8-25
  • Mouse Events 8-25
  • mousePressed Event 8-25
  • mouseDragged Event 8-28
  • Class Level Scope Variables 8-30
  • Project – Blackboard Fun 8-32
  • Project Design 8-32
  • Project Development 8-33
  • Run the Project 8-43
  • Other Things to Try 8-44
  • Summary 8-47

9. Timers, Animation, Keyboard Methods

  • Review and Preview 9-1
  • Timer Class 9-2
  • Java – The Final Lesson 9-13
  • drawstring Method 9-13
  • Animation 9-16
  • Object Disappearance 9-21
  • Border Crossing 9-24
  • Object Erasure 9-29
  • Collision Detection 9-30
  • Keyboard Methods 9-34
  • keyPressed Event 9-35
  • Project – Balloons 9-39
  • Project Design 9-39
  • Project Development 9-40
  • Run the Project 9-56
  • Other Things to Try 9-57
  • Summary 9-59

10. More Topics, More Projects

  • Preview 10-1
  • New Topic – Timing 10-2
  • Project 1 – Computer Stopwatch 10-3
  • Project 2 – Loan Calculator 10-7
  • Project 3 – Checkbook Balancer 10-9
  • New Topic – Dates 10-14
  • Project 4 – Portfolio Manager 10-17
  • Project 5 – Units Conversion 10-22
  • Project 6 – Times Tables 10-26
  • New Topic – Switch Structure 10-30
  • Project 7 – Frown 10-32
  • Project 8 – Tic-Tac-Toe 10-42
  • Project 9 – Decode 10-48
  • Bonus – Pong! 10-56