Chapter 8. Language Level Facility

Table of Contents

Using the Java Language Level Facility
What Does Each Level Provide?
The Elementary Level
The Intermediate Level
The Advanced Level

The Java Language Level Facility provides a student-friendly introduction to Java. There are three levels: Elementary, Intermediate, and Advanced, and each level progressively introduces students to more Java features. When used with a complementary curriculum, they form a powerful learning tool.

Using the Java Language Level Facility

The Java Language Level Facility is fully integrated into DrJava. To select the level at which you wish to work, click on the "Language Levels" menu in the menu bar and select a level. If you do not want to use any Language Level, select "Full Java".

Selecting your level affects how new files are saved and which files can be opened by default. Each file's extension specifies its level. Elementary, Intermediate, and Advanced Level files are given the .dj0, .dj1 , and .dj2 extensions respectively. You can reference classes defined at any language level regardless of the level you are currently using, but you cannot reference full java files unless you have first compiled them seperately.

Because each level is a restricted subset of full java, instructors must be careful when allowing their students to use library functions. For instance, at the Elementary level, "null" is not a valid keyword, so functions that may return null should not be used. Similar caution must be exercised with arrays. Arrays are not introduced until the Advanced level, so library functions that rely on arrays should not be used until then. Also, although we do not allow the mutation of fields or variables at the Elementary and Intermediate levels, we do not prohibit the use of library classes with their own mutation methods such as java.util.LinkedList. Because of this, the students and their teachers must be careful to not use mutable datatypes.

Internally, the Language Level Facility translates .dj0, .dj1 and .dj2 files to .java files with the same name. For example, the file Example.dj1 creates the hidden file named Example.java. Please make sure that you do not have both a Java Language Level file and a .java file with the same name, as this would overwrite your .java file. We also advise against opening the generated .java files. If you do open them, DrJava will warn you when you compile and ask you to close the .java files.