Well, it makes some possibly invalid assumptions, but here's one
possible loop.
import java.io.*;
public class Loop {
public static void main(String[] a) throws Exception {
if (a.length == 0) a = new String[]{"Hello World!"};
if (a[0].length() == 1) System.out.println(a[0].charAt(0));
else {
System.out.print(a[0].charAt(0));
InputStream s = Runtime.getRuntime().exec(new String[]{"java",
Loop.class.getCanonicalName(), a[0].substring(1)}).getInputStream();
int c;
while ((c = s.read()) > 0) System.out.write(c);
}
}
}
You don't need the assumptions in C, and if you're not in a system
with a VM then I'm sure that some will see that you can do something
truly scary with shared pointers. :-)
Paul
--
You received this message because you are subscribed to the Google Groups "The
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.