waltermilner

Untitled

Mar 29th, 2018
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. class Test
  2. {
  3. public static void main(String[] args)
  4. {
  5. int x; // declare x
  6. int y=4; // declare and assign y
  7. y++; // change y
  8. String s; // declare s
  9. }
  10. }
  11. walter@walter-s5-1030uk:~/Documents$ javap -c -l Test.class
  12. Compiled from "Test.java"
  13. class Test {
  14. Test(); // //////////// compiler-written constructor - ignore
  15. Code:
  16. 0: aload_0
  17. 1: invokespecial #1 // Method java/lang/Object."<init>":()V
  18. 4: return
  19. LineNumberTable:
  20. line 1: 0
  21. LocalVariableTable:
  22. Start Length Slot Name Signature
  23. 0 5 0 this LTest; // end constructor ///////////////////////
  24.  
  25. public static void main(java.lang.String[]);
  26. Code: // bytecode of main starts here
  27. 0: iconst_4 // get 4
  28. 1: istore_2 // store in 2 - so y=4
  29. 2: iinc 2, 1 // increment value at 2 - so y++
  30. 5: return // the end
  31. LineNumberTable:
  32. line 6: 0
  33. line 7: 2
  34. line 9: 5
  35. LocalVariableTable: // teh local variables and parameter
  36. Start Length Slot Name Signature
  37. 0 6 0 args [Ljava/lang/String; // String[] args
  38. 2 4 2 y I // y, an int, starts at 2, 4 bytes long
  39. }
Advertisement
Add Comment
Please, Sign In to add comment