---
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: "Amit Singh"  
published: 2011-03-28  
updated: 2020-09-18  
canonical: https://www.mindstick.com/interview/610/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:\

1. passing by value
2. 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 Amit Singh

An argument can be passed in two ways:\

1. passing by value
2. 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/610/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.
