All pastes #637905 Raw Edit

Worst Hello World!

public java v1 · immutable
#637905 ·published 2007-07-29 10:32 UTC
rendered paste body
package irc.test.TestCase;import java.io.BufferedReader;import java.io.File;import java.io.FileReader;import java.lang.reflect.InvocationTargetException;import java.util.ArrayList;public class HelloWorld {	public static void main(String[] args) throws ClassNotFoundException, IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {		new HelloWorld().init();	}	public void init() throws IllegalArgumentException, SecurityException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {		BufferedReader in = null;		ArrayList<String> lines = new ArrayList<String>();		ArrayList<String> extender = new ArrayList<String>();		String pckge = "";		try {			pckge = this.getClass().getPackage().toString().replace("package", "").trim() + ".";			File temp = new File(pckge.replace(".", "/") + "HelloWorld.java");			if(temp.exists()) in = new BufferedReader(new FileReader(temp)); else System.exit(0);			String line;			do {				line = in.readLine();				if(line != null && line.startsWith("class")) {					if(line.indexOf("extends") < 0) {						extender.add(line.replace("class","").replace("{","").trim());					} else {						lines.add(line.replace("class","").replace("{","").replace("extends", "").replace(extender.get(0), "").trim());					}				}			} while(line != null);		} catch (Exception e) {		} finally {			try { in.close(); } catch (Exception E) { System.out.println("ouch1"); System.exit(1); }		}		try {			Class obj = Class.forName(pckge + extender.get(extender.size() - 1));			String msg = obj.getConstructor().newInstance().toString();			for(int i = 0; i < msg.length(); i++) {				Class c = Class.forName(pckge + lines.get(Integer.parseInt(msg.substring(i, i+1)) - 1));				System.out.print(c.getConstructor().newInstance().toString());			}		} catch(ClassNotFoundException e) {			System.out.println("ouch2 " + e);			System.exit(1);		}	}}class Letter {	private char letter;	public Letter(char letter) {		this.letter = letter;	}	public String toString() {		return (this.letter + "");	}}class Order {	private String order = "";	public Order() {		this.order = "12334564738";	}	public String toString() {		return (this.order);	}}class h extends Letter{	public h() {		super('h');	}}class e extends Letter{	public e() {		super('e');	}}class l extends Letter{	public l() {		super('l');	}}class o extends Letter{	public o() {		super('o');	}}class space extends Letter{	public space() {		super(' ');	}}class w extends Letter{	public w() {		super('w');	}}class r extends Letter{	public r() {		super('r');	}}class d extends Letter{	public d() {		super('d');	}}