Method Signature & Header
1. Method Signature
Example: Method Signatures
void display(int x) { } // Signature: display(int)
void display(String s) { } // Signature: display(String)
void display(int x, int y) { } // Signature: display(int, int)2. Why is Return Type NOT Part of the Signature?
int getData() { return 10; }
double getData() { return 10.5; } // Compilation Error (Same signature: `getData()`)2. What is a Method Header?
Example: Method Header vs. Method Signature
Last updated