The official docs just say
14.6. The Empty Statement
An empty statement does nothing.
(https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.6)
Are statements like ;;;;;;;;;;; actually compiled by the Java compiler?
If so, do these statements take time to be executed, like a nop?
In short: does an empty statement really do "nothing"?
The java compiler does nothing with these statements. Hence, they are ignored. The following method
public static void test(){
;;;;;;;;
}
just compiles to the following Bytecode:
public static void test();
descriptor: ()V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=0, locals=0, args_size=0
0: return
LineNumberTable:
line 39: 0
Compilers just use NOPs in certain compilation strategies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With