|
Some special types of methods do not have a method body at all. For instance, the methods defined in an interface, the abstract methods or the native methods (we will see them in chapter 3) do not have a method body. The general format for these methods is:
[modifiers] returntype methodName([argumentList]);
Earlier in this chapter, we saw this type of method declaration in the Search interface. The search() method is declared in this interface as:
public boolean search(String searchString) ;
Note that methods defined within an interface are always without a method body. You cannot define a method with body inside an interface.