Back
Close

Intro to Programming Examples

Anonymous
671.1K views

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.2 From Examples to Testing

Reviewing the Code

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.2 Printing

WelcomeMessage
WelcomeMessage with Print
WelcomeMessage Corrected

9.3 The static keyword

MathExamples
MyMath

9.4 The void keyword

void WelcomeMessage

9.5 The main method

HelloWorld

11.2 Abstracting Common Method Implementations

extends AQuery
extends AQuery
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io