Java support what type of parameter passing ?

Answer Posted / chandrarekha

all the primitive or the simple datatypes(int,float,boolean
etc) are passed as call by value whereas the abstract
datatypes(class objects) are by call by reference.....
for example...
class classA
{
String name;
}
class classB
{
classA a=new classA();
a.name="java";
call(a);//a is an object of classA
void call(classA x)
{
x.name="JAVA";
}
public static void main()
{
......

this is call by reference...

Is This Answer Correct ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does sprintf allocate memory?

597


How do you declare a string variable?

524


What are the different approaches to implement a function to generate a random number?

573


Explain, java is compatible with all servers but not all browsers?

617


What is the purpose of void?

540






What is the full name of java?

573


Which method cannot be overridden in java?

609


Why 1 is not a prime number?

563


Write a program to search a number in the given list of numbers.

634


Can a class be private?

520


Difference between ‘is-a’ and ‘has-a’ relationship in java?

543


What is 16 bits called?

503


Are arrays immutable in java?

549


Is space a character in java?

520


Why java is object oriented?

592