title: Strange behaviour extending abstract class (exercise)
body: <p>I'm studying for Java SE 7 certification exam and I'm doing some boring excercises about inheritance and access modifiers.</p>
  
  <p>But now I'm getting an unexpected behavior applying inheritance. In my base package <code>com.testpkg</code> I have an abstract class:</p>
  
  <pre><code>package com.testpkg;
  
  public abstract class Abstract {
  
      public int test();
  
  }
  </code></pre>
  
  <p><strong>NOTE</strong> that I voluntarily omitted the <code>abstract</code> modifier for the <code>test()</code> method.</p>
  
  <p>Then I have a concrete class extending <code>Abstract</code> in package <code>com.testpkg.sub</code>:</p>
  
  <pre><code>package com.testpkg.sub;
  
  public class Concrete extends Abstract {
  
      public int test() {
          return 0;
      }
  }
  </code></pre>
  
  <p>I test this classes using:</p>
  
  <pre><code>package com.testpkg;
  
  import com.testpkg.sub.Concrete;
  
  public class TestMain {
  
      public static void main(String[] args) {
          Abstract c = new Concrete();
          System.out.println(c.test());
      }
  }
  </code></pre>
  
  <p>If I try to compile this, I obviously get two errors:</p>
  
  <pre><code>The method test() requires a body instead of a semicolon
  </code></pre>
  
  <p><strong>But if I run test class: <code>0</code> is printed on console!</strong></p>
  
  <p>This seems very strange to me. Can you explain why the code is working even <code>test()</code> is wrongly declared in <code>Abstract</code> class?</p>
  
  <p><strong>NOTE</strong> I'm using Eclipse IDE to compile/run my code.</p>