Novice programmers find Java hard because in order to write any
working program, they need to know about classes, methods, and
confusing keywords and syntax: static, void, etc.
J0 (pronounced “J-zero”) solves this problem by letting programmers write methods
and statements outside any class. Yet J0 keeps all of the
power of Java too: any legal Java program is a legal J0
program.
An example program (click on it to toggle between the J0 and Java versions):
Java code:
import java.io.*;
public class NameReader {
public static void main(String[] args) {
try {
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter your name:" );
System.out.print("Name:");
String name = reader.readLine();
System.out.println("Hello, " + name + "!");
} catch (IOException ioe) {
System.out.println(ioe);
}
}
}
|
|
Even for this simple program, Java requires the programmer to
declare a class and a main method, to create complex objects, and
to handle exceptions.
The extra code you have to write in Java is highlighted in red. We don't think
you should have to explain all this code to a novice programmer.
|
Download
The J0 compiler is freely available for public download.
Credits
J0 was developed at Cornell University
using the Polyglot
extensible Java compiler framework. The major contributors
are: