Home »
Java programming language
Java Compiler disable() method with example
Compiler Class disable() method: Here, we are going to learn about the disable() method of Compiler Class with its syntax and example.
Submitted by Preeti Jain, on December 02, 2019
Compiler Class disable() method
- disable() method is available in java.lang package.
- disable() method is used to cause the compiler to stop operation.
- disable() method is a static method, it is accessible with the class name and if we try to access the method with the class object then we will not get any error.
- disable() method does not throw an exception at the time of ceasing operation.
Syntax:
public static void disable();
Parameter(s):
- It does not accept any parameter.
Return value:
The return type of this method is void, it returns nothing.
Example:
// Java program to demonstrate the example
// of void disable() method of Compiler
public class Disable {
public static void main(String args[]) {
// This code is to check whether Compiler is enabled or not
Compiler.enable();
System.out.println("Enabled Compiler by using enable() ");
Compiler.command("{java.lang.Byte.*} (compile)");
byte by = 20;
Byte b = new Byte(by);
// Display value
System.out.println("b = " + b);
// This code is to check whether Compiler is disabled or not
System.out.println("Disabled Compiler by using disable() ");
Compiler.disable();
}
}
Output
Enabled Compiler by using enable()
b = 20
Disabled Compiler by using disable()