I'm trying to learn OGSi framework (Equinox distribution).I have registered my service, but I'm confused about a piece of code that I've copied:IAgendaService service = new AgendaService();What does this line of code mean?I think that in the service object, there are the IAgendaService methods that I've implemented in AgendaService, but I' m not sure about this.Could it be a sort of upcating? (I know that it can't be because there is no inheritance, but I try to find something similar to compare)
Confusion about instance in an interface
java;osgi
AgendaService is a class that implements the IAgendaService interface.  That line is the equivalent to the following:IAgendaService service;AgendaService agendaService = new AgendaService();service = agendaService;The service variable can reference any object that implements IAgendaService.  In the example above, service is referencing an instance of the AgendaService class.AgendaSevice implements IAgendaService, so it must contain all the methods in the IAgendaService interface.  You can call any method in the IAgendaService interface using the service object.  If you attempt to call an AgendaService method, then it will result in a compilation error.To help clarify here is an example.  The processing in the main class will result in the same output.public interface IAgendaService {    public void method1();    public void method2();}public class AgendaService implements IAgendaService {    private String instanceName;    public AgendaService(String instanceName) {        this.instanceName = instanceName;    }    public void method1() {        System.out.println(instanceName +  - method1);    }    public void method2() {        System.out.println(instanceName +  - method2);    }    public void method3() {        System.out.println(instanceName +  - method3);    }}public class Main {    public static void main(String[] args) {       AgendaService agendaService = new AgendaService(1);       agendaService.method1(); // prints 1 - method1       agendaService.method2(); // prints 1 - method2       agendaService.method3(); // prints 1 - method3       IAgendaService iAgendaService = agendaService;       iAgendaService.method1(); // prints 1 - method1       iAgendaService.method2(); // prints 1 - method2       iAgendaService.method3(); // compile error because IAgendaService doesn't have a method3    }}