簡體   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