Signatures
boolean ❶ startsWith(String prefix, int toffset) ❷
Method | Return type | Argument type list |
---|---|---|
void print() |
void | (void) |
int add (int a, int b) |
int | (int, int) |
int max (int a, int b) |
int | (int, int) |
void print (int a, float b) |
void | (int, float) |
void display (float a, int b) |
void | (float, int) |
boolean startsWith❶(String prefix, int toffset) ❷
Method | Method name | Method signature |
---|---|---|
void print() |
(void) | |
int add (int a, int b) |
add | (int, int) |
int max (int a, int b) |
max | (int, int) |
void print (int a, float b) |
(int, float) | |
void display(float a, int b) |
display | (float, int) |
No. 89
Method signature variants
Q: |
Consider the following method definitions:
Which of these have the same method signature as Figure 221, “Defining method signatures ”? |
|||||||||||||||||||||
A: |
We start by the original method:
Its signature may be represented by: {"startsWith", String, int} This describes the method's name and all its argument types among with their respective order. We now cover the different definitions:
|