I have the following code:
import com.apple.dnssd.*;
public interface IServiceAnnouncer {
public void registerService();
public void unregisterService();
public boolean isRegistered();
}
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
This code is saved in the file colled "HelloWorld.java". Java-compiler complains about this code. I writes that class IServiceAnnouncer is public and it should be declared in a file colled IServiceAnnouncer.java.
I have several questions about this situation:
Why compiller says that IServiceAnnouncer is a class? It s an interface. Or interface is a partial case of a class?
If I put the interface IServiceAnnouncer in a separate file colled IServiceAnnouncer.java (as compiler wants), how then can I use it from the HelloWorld.java?
What does it mean "public interface"? What is a difference between the public interface and not public one?