Is there any way to forbid the son class to call the public method of super class in java?
<p>Is there any way to forbid the son class to call the public method of super class in java?</p>

<p>For example</p>

<pre><code>public abstract class TObject{
    abstract public void quark();
}


public class Animal extends TObject{

       public void quark(){
           System.out.println("this is the animal");
       }

}

public class Dog extends Animal{
       @overide
       public void quark(){
           System.out.println("this is the animal");
           **super.quark();**
       }
} 

In this example, The Dog call the **super.quark();** in it's quark method.
</code></pre>

<p>But I don't want the Dog could call <strong>super.quark();</strong> and I also don't want to change the </p>

<p>modifier of quark method in Animal to private. Is there any way to prevent this in compile?</p>

<p>I have be confused couple of days, who can help me........ </p>

<p>The reason  I do that is  I met the similar problem in developing <strong>hudson scm plugin</strong>.I </p>

<p>created the class which extends the SubversionSCM(the offical class). I just wanted to </p>

<p>override the public method of super class, then call super's public method back like </p>

<p>example. but the compile gave error.I don't konw why, how could it do? Dose java  have </p>

<p>something like *<em>reflect way</em>*s to prevent this?</p>
