Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 604 Bytes

Methods.md

File metadata and controls

15 lines (13 loc) · 604 Bytes

A method in Java is a block of code that, when called, performs specific actions mentioned in it You can insert values or parameters into methods, and they will only be executed when called. They are also referred to as functions. The primary uses of methods in Java are:

It allows code reusability (define once and use multiple times). You can break a complex program into smaller chunks of code. It increases code readability.

The six components for declaring the methods are:

  1. Access Specifiers
  2. Return Type
  3. Method Name
  4. Parameter List
  5. Method Signature
  6. Method Body