Pure English

 
Software
Training
Hints & links
 
Computing
Elettronics
Matemathics
Tai Ji Quan
Giada Adriani
 
Thesis
Notes
Reviews
 
Blister
Short stories
Novels
Guests
 
Games
Events
Work-e
Ma.Ste.R.
 
Links
Search
About me
Contacts
Site map
Bandiera inglese Bandiera italiana

jFive

jFive it's a very simple Java project made by just few files, which only purpose is to offer some source files (with more documentation then coding) useful to experiment and/or test the features introduced by Java SE 1.5, also known as "Java 5" or "Tiger". The jFive application is aimed to be executed from the consolle (i.e. from the command prompt, shell or the IDE launch configuration).

Following components are shipped with the jFive project:

  • A build file useful to compile the project using ANT
  • The Java sources, distributed between 2 packages: the root package and the Java 5 Generics package
  • A docs directory listing the application's main features

The ANT build file can be ignored, since it's possible to compile the project using any IDE (i.e. the project does not contain any specific file settings for some existing IDE).

Main features

The project is divided into three sections:

The JavaTester class contains some examples reagarding the main features introduced with Java 5, which are:

  1. Introduction to Generics
  2. Auto-boxing and Auto-unboxing
  3. Syntax of the new for cycle: for(int value : list)
  4. Usage of enum objects
  5. Static import of fields or methods (e.g. Math.PI -> PI)
  6. Output formatted in C style(e.g. System.out.printf)
  7. Formatted input (e.g. the scanner object)
  8. Methods using a variable number of arguments (varargs): method(Object ... args)

The GenericTester class contains some example of usage of Generics:

  1. Creation of Generics and raw types
  2. Nested or complex Generics objects
  3. Invocation of methods using a Generics argument
  4. Usage of "bounded" parameters (e.g. <T extends CharSequence>)
  5. Usage of multiple "bounded" parameters (e.g. <T extends A & B & C ... >)
  6. Implementation of methods based on Generics (e.g. <T extends Class<T>>)
  7. Generics ed inheritance (e.g. Child<A, B> extends Parent<A> only if they share the same type)
  8. The Type Inference mechanism

The WildcardsTester contains examples and comments regarding usage of Wildcards, and some final consideration about some advanced topics:

  1. Usage of the "upper bounded wildcards" in methods signature (e.g. A<? extends B> arg)
  2. Usage of the "unbounded wildcars" in methods signature (e.g. A<?> arg)
  3. Usage of the "lower bounded wildcars" in methods signature (e.g. A<? super B> arg)
  4. Example of usage of wildcars to manage inheritance when using Generics (see. point 7 of GenericTester)
  5. Example of debug of an error due to the wildcard capture issue
  6. A short discussion about the Type Erasure mechanism during compilation of Generics
  7. Example of possible problems due to the usage of Generics and varargs (see point 8 of JavaTester)
  8. A summary of some restrictions about usage of Generics

All the material (JavaDoc and comments) is in english.

Download

JFive 1.0