I wrote a proof of concept as a guide.
Interface:
public interface IVehicle {
int GetNumWheels();
}
Implementing class:
public class Car implements IVehicle{
@Override
public int GetNumWheels() {
return 4;
}
}
Main:
public class ABC {
public ABC(){}
public int NumWheels(IVehicle v)
{
return v.GetNumWheels();
}
public static void main(String[] args) {
ABC a=new ABC();
Car c=new Car();
String ans = String.format("%s has %d wheels", c.getClass().getName(), a.NumWheels(c));
System.out.println(ans);
}
}