answersLogoWhite

0


Best Answer

Here is an example program that passes a Scanner object:

import java.util.*;

public class Conversion

{

public static void main(String[] args)

{

Scanner in = new Scanner(System.in);

doSomething(in);

}

public static void doSomething(Scanner in)

{

int q = in.nextInt();

System.out.println("The value you entered is: " + q);

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

Parameters are passed into a method when they are invoked. For ex:

public int add(int a, int b){

return a + b;

}

The above method is going to return the sum of the two numbers that are passed as argument. So if this method were to be invoked, it would be like this:

int sum = add(5, 10);

here we are passing the two values to be added 5 & 10 as parameters when invoking the method.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

It is called a "real parameter"

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a value that is passed into a method when it is called?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is a visual basic function?

A function is a segment of code which you pass a value to and get a value back from, the function acts upon (or not) that value passed to it and returns a value to the calling method; this makes it slightly different from a Sub, which returns no value to its calling method.


How does java pass primitive types and objects?

Java uses only pass by value. Primitive data types are passed purely as pass by value whereas for objects a value which is the reference to the object is passed. Hence the whole object is not passed but its reference gets passed. All modifications to the object in the method would modify the object in the Heap.


Why should the java main method has the return type as void?

A void method is one that returns no value. The Java main() method is the first method to be called, therefore it doesn't need to return a value to another Java method, therefore it is declared as void. If something needs to be returned to the operating system, this is done differently, not by "returning a value" in the sense of Java.


What is the implicit name of the parameter that gets passed into the set method property of a class aData b Property c Value d Object?

Value, and its datatype depends on whatever variable we're changing.


What are parameters in java?

A parameter or an argument is a value that is passed to a method so that the method can use that value in its processing. Ex: public String getName(String x){ return "Mr. " + x; } Here the method just prefixe's a Mr. with the value that is being passed to the method getName. The value X can be termed a parameter or an argument

Related questions

Differences between pass by value pass by reference in java?

pass by value is the technique where a copy of the variable is passed to the method as argument. This value can be modified inside the method but that would not affect the original value. Pass by reference is the technique where the reference to the actual variable is passed to the method as argument. Any changes to this variable would affect and alter the original value. Usually primitive data types are passed by value and objects are passed by reference in java.


What is passed toward the method in java?

Java uses pass by value semantics by default.


What is a visual basic function?

A function is a segment of code which you pass a value to and get a value back from, the function acts upon (or not) that value passed to it and returns a value to the calling method; this makes it slightly different from a Sub, which returns no value to its calling method.


How many times init method called if more then one instence are in servlet?

I have two questions how many times a method, modules or subroutines can be called? in most languages, how a variable is passed to a method?


How is a method called in java?

method header and method body There are two ways to call a method; the choice is based on whether the method returns a value or not.


How does java pass primitive types and objects?

Java uses only pass by value. Primitive data types are passed purely as pass by value whereas for objects a value which is the reference to the object is passed. Hence the whole object is not passed but its reference gets passed. All modifications to the object in the method would modify the object in the Heap.


What is mean by'pass by value'?

If you mean 'call by value' then, it means a method of passing argument to a function in c++. In this a copy of argument is passed to function and changes are not reflected.


What do you call an argument that only has a copy of the arguments value and will not be affected by the method?

That is called passing an argument by value.


Do functions get called by reference only?

No. Function parameters are passed by value. Always. Even the so called "call by reference" is a value - the value of the pointer or the address of the object - but what is placed in the parameter list is a value.


Why should the java main method has the return type as void?

A void method is one that returns no value. The Java main() method is the first method to be called, therefore it doesn't need to return a value to another Java method, therefore it is declared as void. If something needs to be returned to the operating system, this is done differently, not by "returning a value" in the sense of Java.


When only a copy of the argument's value is passed into the paremeter variable?

By default, a copy of the argument's value is passed into the parameter variable. This is "call by value" semantics, and the called function can do whatever it wants with the parameter, but it cannot alter the original copy. Sometimes, in C and C++, you can pass the address of the value instead. This is "call by address" semantics, but the called function must be designed to handle it - in this case, the called function can alter the original value. (Actually, it is always "call by value" - what we call "call by address" is simply passing the value of the address, a subtle distinction which is important to understanding the language.)


What is the implicit name of the parameter that gets passed into the set method property of a class aData b Property c Value d Object?

Value, and its datatype depends on whatever variable we're changing.