CPS406/606 Class examples, Lecture 2 Java, Fall 99
Language Basics
Variables and Types: Sum.java
Source
Example Run
Arrays, For Loop: SumArray.java
Source
Example Run
While loop, If tests: GradeAverage.java
Source
Example Run
More arrays and Math: RollDice.java
Source
Example Run
Strings and Streams: GradeAvStr.java
Source
Example Run
Method definition and calls: VolumeStr.java
Source
Example Run
Recursive Function: Factorial.java
Source
Example Run
Object-Oriented Concepts and Exceptions
Data Class Definition: Account.java
Source
Use of this Class: AccountTest2.java
Source
Example Run
Child Class Definition: AccountCmp.java
Source
Use of this Class: AccountCmpTest1.java
Source
Example Run
Class method with Exception: AccountException.java
Source
Use of this Class: AccountTestException.java
Source
Example Run