Test 1 Review Sheet

This is a checklist of topics that have been covered (or reviewed, in the case of basics that are common to C++ and Java) in the course so far.

Building Basic Java Programs

Basic Elements

Control Structures (Chapters 4-5)

Methods (Chapter 6)

Console I/O

Arrays (Chapter 7)

Some practice array algorithms to try (coding practice)

(You should be able to do these and other similar array algorithms)

Newer Java 1.5.0 features discussed

Classes and Objects (chapter 8)

Tools

Strings

Inheritance and Polymorphism (chapters 9 and 10)

Exception Handling (chapter 11)

Nested Classes and Inner Classes

Sorting Arrays

Files and Streams

Programming hints

Here is a sample programming problem similar to how I might ask a question on the test


Sample Exercise

Write a method that will return the number of elements in an array that are greater than a given number.

Given this sample main method:

public static void main(String[] args)
{
    int[] array = {14, 6, 3, 2, 8, 5};
    System.out.println("Given the following: array = ");
    printArray(array);
    System.out.println();
    System.out.println("The number of elements greater than 5 is " +
                       greater(array, 5));
}
  

The output is:

Given the following: array = {14, 6, 3, 2, 8, 5}
The number of elements greater than 5 is 3
  
Write the method called greater