Java.lang.Compiler.disable() 方法
描述
java.lang.Compiler.disable() 方法导致编译器停止运行。
声明
以下是 java.lang.Compiler.disable() 方法的声明。
public static void disable()
参数
NA
返回值
此方法不返回任何值。
异常
NA
示例
下面的例子展示了 java.lang.Compiler.disable() 方法的使用。
package com.tutorialspoint;
import java.lang.*;
public class CompilerDemo {
public static void main(String[] args) {
// checking if compiler is enabled or not
Compiler.enable();
System.out.println("Compiler Enabled...");
Compiler.command("{java.lang.Integer.*}(compile)");
Integer i = new Integer("30");
// returns a hash code value
int retval = i.hashCode();
System.out.println("Value = " + retval);
// disable the compiler
System.out.println("Disabling Compiler...");
Compiler.disable();
}
}
让我们编译并运行上面的程序,这将产生下面的结果 −
Compiler Enabled... Value = 30 Disabling Compiler...

