In which way does a Primitive data type is passed ?

Answer Posted / sailendra.n.jena

primitive datatype are pass this way
class A
{
int x=7;
void disp(int z)
{
System.out.println(z);
}
}
class Test
{
public static void main(String args[])
{
int x=7;
A a=new A();
a.disp(x);
}
when u pass the primtive reference to this method only
address will transfer to the parameter which i have given
to the void disp(int z).After passing the reference
variable the other variable will pointing to that object &
collect the value of that object.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we override final method?

571


What is an infinite loop? How infinite loop is declared?

574


What is the difference between call by reference and call by pointer?

507


What is the final blank variable?

596


Can a class have an interface?

557






Does the order of public and static declaration matter in main method?

621


How do I type unicode?

540


What is nested top-level class?

582


What is extension method in java?

565


What is entry set in java?

539


When we serialize an object does the serialization mechanism saves its references too?

512


Tell me about your ability to work under pressure

1771


When a byte datatype is used?

571


What is a variable and constant?

550


What is a void method java?

522