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
What is the Difference between Final Class && Abstract Class?
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.
what is method reference in java 8?
Can we extend private class in java?
How do you sort arrays in java?
What is the default size of arraylist in java?
What are heterogeneous objects?
Can there be an abstract method without an abstract class?
Why pass by reference is not possible in java?
What is a buffer in java?
Is static a singleton?
What is meant by main method?
What is files manifesting?
What is empty string literal in java?
How does callback work in java?