The goal of an interface is to mandate a specific and well-known contract for a known type of object. For example, by tradition all Stacks have push(), pop(), and peek(). So by writing an interface, you're expressly writing a contract that anyone who writes a stack should follow.
To put in another way, it is a template that dictates that any class that calls itself a Stack must implement methods called push(), pop(), and peek() as my example here discusses.
public interface StackInterface {
public void push(int x);
public int pop();
public void peek();
}
public class myStack implements StackInterface{
}
It's an object-oriented technique. At this point you will not get a compile because you haven't at least implemented methods for the interface methods. You will need to write methods matching the signatures of the Interface before you can fully use the interface.