☞A program segment that contains executable instructions within { }, to perform a specific task is known as Method or Function.
☞It exist as a members of a class.
☞Syntax : <access_specifier> <return_type> <function_name><(Parameter List)>{....}
☞Example : public int sum(int a, int b) {……}
public ➺ access_specifier int ➺ return_type sum ➺ function_name a,b ➺ parameter_list
☞public int sum(int a, int b) is known as function_header and {……} is known as funtion_block.
☞It is used to reuse the segment of code, as and when necessary.
☞It occupies less memory space and executes faster.
☞It divides a complex computational task into a collection of smaller methods.