Java Questions

By P. Conrad, for CISC474, Spring 2007

  1. Java 5.0 introduced several new features. One of these is "Autoboxing and Auto-Unboxing of Primitive Types". Explain what this means, and write (or find a link to) a minimal complete Java program (a small example) that illustrates the idea. (By minimal, I mean that the program should be just large enough to illustrate the idea, and not even the tiniest bit larger than that. By complete, I mean that the program should contain a public static void main method, and you should be able to compile and execute it from a normal Java 5.0 environment.
  2. Another new feature of Java 5.0 is enumerated types. Write (or find a link to) a minimal complete Java program that illustrates the use of enumerated types.
  3. Java 5.0 also introduced a new kind of for loop: for (int cell: someArrayOfInts) ...
    Explain this new syntax, and write (or a find a link to) a minimal complete Java program that illustrates this feature.
  4. Java 5.0 also introduced a new <> syntax for collections: ArrayList<Dog> x = new ArrayList<Dog>();
    Write, or find a link to, a minimal complete Java program that illustrates this feature.
  5. JUnit is used for test-driven development, and unit testing. Briefly describe how "test-driven development" differs in its basic approach to software development from other more traditional approaches.
  6. What is Ant, and what is its role in Java software development?
  7. What is the language in which an Ant build file is written?
  8. Explain the purpose of these three Ant concepts: project, target and task.
  9. Explain the concept of CLASSPATH.
  10. Explain what a JAR file is, how to create one, how to unpack one, and how to include one in your CLASSPATH.