Thursday Review Quiz

Take this quiz to review yesterday's material. The quiz is open-book, open-note and open-neighbor (feel free to work together)!

For the questions that involve coding, you can just write your answers on a piece of paper -- you don't need to type them into the computer, compile and run them (unless you really want to).

  1. Write a program fragment that intializes an array of 100 integers to random values between 0 and 100. Hint - for help on generating random numbers, look in the java.util.Random class in the Java Docs.
  2. Repeat the above question, but use an ArrayList instead of a simple array.
  3. Discuss the performance differences between the java.util.ArrayList and java.util.LinkedList classes.
  4. Write a class that implements the java.awt.event.MouseListener interface with empty methods. Don't worry too much about what this interface does, just make sure that your class is syntactically correct.
  5. Optional Bonus Question  Suppose you wanted to let programs determine whether two PartTime objects (from your lab) represent the same person. What would be the "preferred Java" way to do this? Hint: Think about how to check Strings to see if they have the same characters. Write a sample implementation.