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

What is the Difference between Final Class && Abstract Class?

613


there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box.

1569


what is method reference in java 8?

550


Can we extend private class in java?

542


How do you sort arrays in java?

517






What is the default size of arraylist in java?

498


What are heterogeneous objects?

562


Can there be an abstract method without an abstract class?

531


Why pass by reference is not possible in java?

490


What is a buffer in java?

567


Is static a singleton?

519


What is meant by main method?

577


What is files manifesting?

1720


What is empty string literal in java?

555


How does callback work in java?

599