Test 1 Review Sheet

Building Basic Java Programs

Basic Elements

Control Structures (Chapters 4-5)

Methods (Chapter 6)

Arrays (Chapter 7)

Some practice array algorithms to try (coding practice)

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

Classes and Objects (chapter 8)

Basic GUI

Programming hints

Here is a sample programming problem similar to how the test will ask a question.


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
  

The method signature is:

public static int greater(int[] array, int number)