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

Explain the importance of throws keyword in java?

559


Write a function for palindrome and factorial and explain?

646


What is the difference between a constructor and a method?

558


Can we create object of inner class in java?

487


What is java lang object?

518






What is the right data type to represent a price in java?

560


What is singletonlist in java?

499


How many types of interfaces are there?

566


When to use runnable interface vs thread class in java?

510


How to perform bubble sort in java?

580


Is constructor inherited?

522


What is the char data type?

511


What are the types of relation?

560


What is command line argument

697


What are the types of collections in java?

530