繁体   English   中英

Java-如何在子类中调用超级实现方法?

[英]Java- How to call Super Implementation method in subclass?

如果在子类中覆盖了相同的方法,我如何在子类中调用超级实现?

`

// This interface is in different File

public Interface ParentClass {
ResponseEntity<byte[]> getName(firstName, LastName)  // How can i use this interface defined under getAllData     
}

// This method is in different File

public class ChildClass implements ParentClass {
public getAllData(fName, lName) { 
 ResponseEntity<byte[]> hObject = getName(fName, lName);    // this is calling below Overridden method. How to call super Implementation Interface here.
}

@Override
public getName(fName, lName) {  // This is getting called everytime during service call
    throw new Exception();
  }
}
// Before writing this Override method i was able to access Parent Interface

`

我也无法删除 Override 方法.. 请帮助我。 提前谢谢了

// This method is in different File

public class ChildClass implements ParentClass {
public getAllData(fName, lName) { 
 return super.getName(fName, lName);    
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM