Java Questions
By P. Conrad, for CISC474, Spring 2007
- 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.
- 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.
- 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.
- 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.
- 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.
- What is Ant, and what is its role in Java software development?
- What is the language in which an Ant build file is written?
- Explain the purpose of these three Ant concepts: project, target and task.
- Explain the concept of CLASSPATH.
- Explain what a JAR file is, how to create one, how to unpack one, and how to include one in your CLASSPATH.