![]() |
VOOZH | about |
Compiler Class provides support and related services to Java code to Native Code. Native code is a form of code that can be said to run in a virtual machine (for example, [JVM]Java Virtual Machine).
Declaration:
public final class Compiler extends Object
The java.lang.Compiler.command() tests the argument type and performs some documented operations.
Syntax:
public static boolean command(Object argument)
Parameters:
Return: It returns the compiler-specific value.
Exception: It throws NullPointerException.
The java.lang.Compiler.compileClass() compiles the specified class.
Syntax:
public static boolean compileClass(Class c)
Parameters:
Return: It returns true if the compilation succeeded. Else, false.
Exception: It throws NullPointerException.
The java.lang.Compiler.enable() cause compiler to start operation.
Syntax :
public static void enable()
Return: It returns nothing.
The java.lang.Compiler.disable() stops compiler to perform operations.
Syntax :
public static void disable()
Return: It returns nothing.
The java.lang.Compiler.compileClasses() compiles the classes having the name as string - "str".
Syntax:
public static boolean compileClasses(String string)
Parameters:
Return: It returns true if the classes are compiled successfully.
Exception: It throws NullPointerException.
Output:
class NewClass$CompilerClass Value : null Is compilation successful ? : false Is compilation successful using str ? : false
Note: The Compiler Class in Java inherits others methods from the Object class in Java.