I have literally just started and I think this is such a basic question that I can't even find anything online about it but I can't for the life of me figure this out.
I have two seperate bundles, one an API and one a Service bundle. In a package in the API bundle I have an interface called "HelloAPI":
package com.example.osgi.api;
public interface HelloAPI {
public void sayHello();
}
In the service bundle I have a class with the following code:
package com.example.osgi.service;
public class HelloImpl {
implements HelloAPI {
System.out.println("Hello World!");
}
}
but eclipse has highlighted an error under the "implements" keyword which is:
Syntax error on token "implements", interface expected.
I can't see what I've done wrong, can anyone point me in the right direction? Thanks.
I strongly agree with the comments — it's vital to learn the fundamentals of the Java language before tackling more advanced topics like modularity.
For reference, here is a correct implementation of your interface:
public class HelloImpl implements HelloAPI {
public void sayHello() {
System.out.println("Hello World!");
}
}