We can use inherited methods only in the definition of the sub class.

jabber (jabber)
This is a flaw in Java. Once a subclass extends a superclass, there is
NO WAY to use the methods of the super class. We can use inherited methods ONLY
in the definition of the subclass. Please look at the following toy code.

class Daddy{
public void smoke(){
System.out.println("Cigar! Cigar!");

class Sonny extends Daddy{
public void smoke(){
//This calling of inherited methods is OK!
System.out.println("Marlboro! Marlboro!!");

public class Test{
Sonny sonny = new Sonny();
// The following code does not work!
2000-10-24 -05:00

回到话题: java problem

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论