Home » Java programming language

Java Compiler enable() method with example

Compiler Class enable() method: Here, we are going to learn about the enable() method of Compiler Class with its syntax and example.
Submitted by Preeti Jain, on December 02, 2019

Compiler Class enable() method

  • enable() method is available in java.lang package.
  • enable() method is used to cause the compiler to resume operation which is stopped by using a disable() method.
  • enable() 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.
  • enable() method does not throw an exception at the time of resuming operation.

Syntax:

    public static void enable();

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 enable() method of Compiler 

public class Enable {
    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);
    }
}

Output

Enabled Compiler by using enable() 
b = 20


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.