Tuesday/Wednesday 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 for loop that counts from 100 to 0 backwards by fives and prints the results to the console.
  2. What is the difference between the & and && operators?
  3. Define the notion of an object. What is an object made up of?
  4. Explain what the heap and the stack are in the Java Virtual Machine.
  5. Explain the difference between overloading and overriding methods.
  6. Discuss what the static modifier does on a method definition. How do you call a static method? Write an example.
  7. Suppose you write an application with 20 Java classes. How many source files would you have? How many main methods would you have?
  8. Explain the differences between public, private and package-level access to class members.
  9. Optional Bonus Question  In C++, a class can define a destructor method that the system calls when an object is deallocated. Discuss why Java does not support destructors.