- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do we pass parameters by value in a Java method?
Passing Parameters by Value means calling a method with a parameter. Through this, the argument value is passed to the parameter.
Example
public class SwappingExample { public static void swapFunction(int a, int b) { int c = a+b; System.out.println("Sum of the given numbers is ::"+c); } public static void main(String[] args) { int a = 30; int b = 45; swapFunction(a, b); } }
Output
Sum of the given numbers is ::75
- Related Articles
- How do we pass parameters by value in a C# method?
- How do we pass parameters by reference in a C# method?
- How to pass parameters to a method in C#?
- How do we pass an array in a method in C#?
- Pass by reference vs Pass by Value in java
- How can we pass lambda expression in a method in Java?
- How to pass parameters using param array in a C# method?
- Is java pass by reference or pass by value?
- How is Java strictly pass by value?
- How do we initialize an array within object parameters in java?
- Why do we pass a Pointer by Reference in C++?
- What is the difference between pass by value and reference parameters in C#?
- How do we call a Java method recursively?
- How to pass reference parameters PHP?
- How to pass the value 'undefined' to a function with multiple parameters in JavaScript?

Advertisements