Test 2 Review Checklist

These are the new topics covered since test 1.

Methods (i.e. functions)

Method Basics

Using Methods

Building Methods


Strings


Arrays

Some practice array algorithms to try (coding practice)

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

Classes and Objects


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