"java/lang/Object",
"HelloWorld.java");
ConstantPool cp = cf.getConstantPool();
CfMethod method = cf.addMethod(JVM.ACC_PUBLIC, "<init>", "()V");
CodeBuilder code = new CodeBuilder(method);
code.add(JVM.ALOAD_0);
code.add(JVM.INVOKESPECIAL, cp.addMethodRef(false,
"java/lang/Object",
"<init>",
"()V"));
code.add(JVM.RETURN);
code.flush();
method = cf.addMethod(JVM.ACC_PUBLIC + JVM.ACC_STATIC,
"main",
"([Ljava/lang/String;)V");
code = new CodeBuilder(method);
code.add(JVM.GETSTATIC, cp.addFieldRef("java/lang/System",
"out",
"Ljava/io/PrintStream;"));
code.add(JVM.LDC, "Hello world!");
code.add(JVM.INVOKEVIRTUAL, cp.addMethodRef(false,
"java/io/PrintStream",
"println",
"(Ljava/lang/String;)V"));
code.add(JVM.RETURN);
code.flush();
return cf.writeToArray();
}