Online Java Compiler By
JavaTpoint.com
public class CompilerEnableExample1 { public static void main(String[] args) { CompilerCompileClassExample1 c1 = new CompilerCompileClassExample1(); CompilerCompileClassExample1 c2 = new EnableExample(); //Enabling the compiler System.out.println("Enabling the compiler!!"); Compiler.enable(); //class CompilerCompileClassExample1 Class g1 = c1.getClass(); System.out.println(g1); //subclass CompilerExample Class g2 = c2.getClass(); System.out.println(g2); //Using compileclass method String str = "CompilerCompileClassesExample1"; boolean r = Compiler.compileClasses(str); System.out.println("Value returned by method is : "+r); //Disabling the compiler System.out.println("Disabling the compiler!!"); Compiler.disable(); } } class EnableExample extends CompilerCompileClassExample1{ //It is subclass of CompilerCompileClassExample1 }
Output