Parameter vs Argument in Java

Yatin B.Yatin B.
1 min read

Date: 2023-05-25

In Java, parameters are variables declared in a method's signature, acting as placeholders for input values. Arguments are the actual values passed to a method when it's called. Parameters define the method's expected input types, while arguments provide the specific data. Understanding this distinction is crucial for writing effective Java code. The method greet("John") uses "John" as an argument corresponding to the name parameter. Similarly, addNumbers(5, 7) passes 5 and 7 as arguments to the a and b parameters respectively.

Read more: https://examples.javacodegeeks.com/parameter-vs-argument-in-java/

0
Subscribe to my newsletter

Read articles from Yatin B. directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Yatin B.
Yatin B.