1

i have an interface which has an abstract method

public abstract String newId(Connection paramConnection, String paramString1, long paramLong1, long paramLong2, long paramLong3, String paramString2, Map paramMap, int paramInt)
throws IOException;

in a JAR.

But how do i find where exactly in the Run time we define this method/override this method to get Retun string value .?

Tech Cruize
  • 107
  • 1
  • 2
  • 16
  • 2
    by either finding the anonymous class implementation of this `Interface`, or finding the `classes` implementing this `Interface`. – SomeJavaGuy Dec 13 '16 at 09:18
  • 1
    Hav a look at this SO thread https://stackoverflow.com/questions/347248/how-can-i-get-a-list-of-all-the-implementations-of-an-interface-programmatically – SubOptimal Dec 13 '16 at 09:33

1 Answers1

0

Where you want to overwrite this method just implement this interface like

interface interfaceName{  
void sample();  
}  

class Main implements interfaceName{  
public void sample(){System.out.println("Hello");}  

public static void main(String args[]){  
Main obj = new Main();  
obj.sample();  
 }  
}  
Rishabh Mahatha
  • 1,251
  • 9
  • 19
  • i Dont want to implement the method but to extract what is happening at runtime or what body this method substituted with.! – Tech Cruize Dec 13 '16 at 10:30
  • Actually, when we make an abstract method, then we don't need to define its body we just declare that method. Whenever we want to use that method according to our method body. we can override its body as per the requirement. – Rishabh Mahatha Dec 13 '16 at 10:33
  • Agreed, but "we can override its body as per the requirement" -> its overridden now , can we find overridden body some how.! FYI its not implemented by me and want to know what exactly happening. – Tech Cruize Dec 13 '16 at 10:37
  • If you are not implementing the Inteface in which the abstract method is declared then when you make the method with the same name into class. Then the method is not, which is declared in the interface. – Rishabh Mahatha Dec 13 '16 at 10:42