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