Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>But can any body tell me what's the difference between Inner.redo1() and Inner.redo2()?</p> </blockquote> <p><code>Inner.redo1()</code> and <code>Inner.redo2()</code> are indeed the same. There is no semantic or functional difference. <code>redo2</code> is more explicit. That is all.</p> <p>Let's compare each method's bytecode:</p> <pre><code>λ Desktop javap -c Outer.Inner Compiled from "Outer.java" public class Outer$Inner extends java.lang.Object{ final Outer this$0; public Outer$Inner(Outer); Code: 0: aload_0 1: aload_1 2: putfield #1; //Field this$0:LOuter; 5: aload_0 6: invokespecial #2; //Method java/lang/Object."&lt;init&gt;":()V 9: return public void redo1(); Code: 0: aload_0 1: getfield #1; //Field this$0:LOuter; 4: invokevirtual #3; //Method Outer.print:()V 7: return public void redo2(); Code: 0: aload_0 1: getfield #1; //Field this$0:LOuter; 4: invokevirtual #3; //Method Outer.print:()V 7: return } </code></pre> <p>Same bytecode, same end result, same everything.</p> <hr> <blockquote> <p>Why does it use ArrayList.this.remove(lastRet); but not remove(lastRet); ?</p> </blockquote> <p>To disambiguate which class' <code>remove()</code> method should actually be called. It is actually necessary in this case! Without explicitly specifying <code>ArrayList.this.remove(lastRet)</code>, the code does not compile:</p> <pre><code>λ Desktop javac java/util/ArrayList.java java/util/ArrayList.java:810: remove() in java.util.ArrayList&lt;E&gt;.Itr cannot be applied to (int) remove(lastRet); ^ 1 error </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload