---
title: "How many ways can an argument be passed to a subroutine and explain them?"  
description: "How many ways can an argument be passed to a subroutine and explain them?"  
author: "Pushpendra Singh"  
published: 2010-10-25  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/166/how-many-ways-can-an-argument-be-passed-to-a-subroutine-and-explain-them  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# How many ways can an argument be passed to a subroutine and explain them?

An argument can be passed in two ways. They are passing by value and passing by reference. \
\
Passing by value: This method copies the value of an argument into the formal parameter of the subroutine. \
Passing by reference: In this method, a reference to an argument (not the value of the argument) is passed to the parameter.\
\

## Answers

### Answer by Pushpendra Singh

An argument can be passed in two ways. They are passing by value and passing by reference. \
\
Passing by value: This method copies the value of an argument into the formal parameter of the subroutine. \
Passing by reference: In this method, a reference to an argument (not the value of the argument) is passed to the parameter.\
\


---

Original Source: https://www.mindstick.com/interview/166/how-many-ways-can-an-argument-be-passed-to-a-subroutine-and-explain-them

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
