Tuesday, December 16, 2008
Monday, December 15, 2008
Method signature and method header
The signature of a method consists of the name of the method and the description (i.e., type, number, and position) of its parameters.
Example:
The header of a method consists of the signature plus the description of (the type of) the result.
Example:
Two methods of the same class can have the same name, provided they have different signatures. Methods with the same name (but with different signatures) are said to be overloaded. For example, the substring() method in the class String.
Example:
- toUpperCase()
- println(String s)
The header of a method consists of the signature plus the description of (the type of) the result.
Example:
- String toUpperCase()
- void println(String s)
Two methods of the same class can have the same name, provided they have different signatures. Methods with the same name (but with different signatures) are said to be overloaded. For example, the substring() method in the class String.
Subscribe to:
Posts (Atom)