waltermilner

Untitled

Feb 26th, 2019
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. Java source code:
  2. public class Test {
  3.  
  4. public static void main(String[] d) {
  5.  
  6. String str = "Hello";
  7. for (int i = 0; i < str.length(); i++);
  8.  
  9. }
  10.  
  11. }
  12. compiles to:
  13. public static void main(java.lang.String[]);
  14. Code:
  15. 0: ldc #2 // String Hello
  16. 2: astore_1 // slot 1 is reference to "Hello"
  17. 3: iconst_0
  18. 4: istore_2 // does i=0
  19. 5: iload_2 // get i
  20. 6: aload_1 // get "Hello"
  21. 7: invokevirtual #3 // Method java/lang/String.length:()I
  22. 10: if_icmpge 19 // compare i with length
  23. 13: iinc 2, 1 // i++
  24. 16: goto 5 // loop back
  25. 19: return
  26. LineNumberTable:
  27. line 7: 0
  28. line 8: 3
  29. line 12: 19
  30. LocalVariableTable:
  31. Start Length Slot Name Signature
  32. 5 14 2 i I
  33. 0 20 0 d [Ljava/lang/String;
  34. 3 17 1 str Ljava/lang/String;
Advertisement
Add Comment
Please, Sign In to add comment