object Hello { def main(args :Array[String]) { var i = 1 val k = i } }
jvm代码
public final class Hello$ { public static Hello$ MODULE$; public static {}; Code: 0: new #2 // class Hello$ 3: invokespecial #12 // Method "<init>":()V 6: return public void main(java.lang.String[]); Code: 0: iconst_1 1: istore_2 2: iload_2 3: istore_3 4: return }
-------Java
public class Hello2 { public static void main(String args[]) { int i = 1; int k = i; } }
public class Hello2 { public Hello2(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: return public static void main(java.lang.String[]); Code: 0: iconst_1 1: istore_1 2: iload_1 3: istore_2 4: return }