(CPEN 221) A Gentle Introduction to Java

GSathish
25.9K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

1.1 Programs, Fields

First Example
Second Example

1.2 Java as a Calculator

Operators
Operators
Not Quite Math
Not Quite Math
Negative Results

1.3 Syntax

Syntax
Syntax
Syntax

2.1 Using Fields

Using Fields
Using Fields
Getting Paid
Calculating Revenue

2.2 Beyond ints

String Examples
Conctenating Strings
Conctenating Strings
Video Game Example Initial Attempt
Video Game Example Second Attempt
Number Precision
Rectangle

2.3 Java Checks Types

Mixing Strings and ints
Mixing Strings and ints
Mixing Strings and ints

3.1 Capturing Repeated Work with Methods

Using Methods
Using Methods
Using Methods

3.2 Methods as Descriptions of Tasks

Implementing Tasks
Following the Design Recipe
Following the Design Recipe

3.3 With Great Power Comes More Opportunity for Mistakes

Understanding Errors
Understanding Errors
Understanding Errors
Understanding Errors

4.1 Beyond Arithmetic and Concatenation

Using Conditions
Using Conditions
Using Conditions
Using Conditions

4.2 More Examples of Decision-Making Programs

Using Conditions
Using Conditions
Using Conditions

5.1 Representing Compound Data

Combining Data into Classes

5.2 More on Methods

Creating Instances of Classes

5.3 Variables and Scope

Total Cost Calculation
Variable fill-in
Bad Scope
Bad Scope Experimentation

6.1 More Classes

ExamplesBook
Same Author?

6.2 From Examples to Testing

Reviewing the Code
Using Tester
When Tester fails

7.1 Nested Data

RectRegion
RectRegion examples
ExamplesRegion
contains
belowLeftOf
aboveRightOf
contains

7.2 More Regions

Why did the math teacher's plants keep dying? -- Because they grew square roots.
Square Roots
Square Roots

8.1 Searching for Images

Image Data
largerThan

8.2 Queries as Data

matches
matches

8.3 Identifying Common Behaviors

Field access (or lack thereof)

8.4 Combining Queries

AndQuery
ContainsKeyword
Combining AndQueries
OrQuery

9.1 Intro to Arrays

Arrays
Arrays of numbers

9.2 static methods

MathExamples
MyMath

9.3 main, void, and printing

HasAMainMethod
HasAMainMethod (and an error!)
Hello, World!
Printing is fun

10.1 Arrays of command line arguments, loops

SampleMain
SumMain
CalcMain

10.2 More Iteration Patterns

ExamplesArrays
Intersperse

10.4 More Array Manipulation

AddAtEnd

11.1 Arrays of Arrays

TheaterExamples.java
TheaterExamples.java
TheaterExamples.java
TheaterExamples.java
TheaterExamples.java

Generics

12.1 Generics

DirectoryExamples.java
ClassDatabaseExamples.java
LookupTableExamples.java
IntegerTableExamples.java

12.2 Java Collections

ArrayListExamples.java
ArrayListExamples.java
ArrayListExamples.java
ArrayListExamples.java
ArrayListExamples.java
SetExamples.java
SetExamples.java
SetExamples.java
MapExamples.java
MapExamples.java
MapExamples.java

13.1 Combining Queries, Part II

ExamplesSearch.java
ExamplesSearch.java
ExamplesSearch.java

13.2 Abstracting Common Method Implementations

extends AQuery
extends AQuery

13.3 Abstracting Common Fields

super

13.4 Talking About Abstract Classes

Class hierarchy
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content