With NetRexx you can develop Java applications fast and easily. For example, consider the simplest application that says "Hello!" to the world. Compare the two chuncks of code:
Java/* This is Hello.java */
class Hello {
public static void main(String[] arg) {
System.out.println("Hello! World.");
}
}
|
NetRexx/* This is Hello.nrx */ say'Hello! World.' -- -- -- -- |
notes
|
If you need to get data from the standard input stream, code remains simple. This program asks your name and answers politely:
Java/* This is HelloYou.java */
import java.io.IOException;
class HelloYou { // This is a comment
public static void main(String[] arg) {
String name = "";
System.out.println("Who are you?");
try {
byte[] answer = new byte[30];
int len = System.in.read(answer);
name = new String(answer,0,len);
} catch(IOException e) {
name = "exception";
}
System.out.println("Hello! "+name);
}
}
|
NetRexx/* This is HelloYou.nrx */ say"Who are you?" -- This is a comment name=ask SAY'Hello!' Name -- -- -- -- -- -- -- -- -- -- -- -- |
notes
|
[Index] [Previous Chapter] [Next Chapter]
hosted by