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
Can we override final method?
What is an infinite loop? How infinite loop is declared?
What is the difference between call by reference and call by pointer?
What is the final blank variable?
Can a class have an interface?
Does the order of public and static declaration matter in main method?
How do I type unicode?
What is nested top-level class?
What is extension method in java?
What is entry set in java?
When we serialize an object does the serialization mechanism saves its references too?
Tell me about your ability to work under pressure
When a byte datatype is used?
What is a variable and constant?
What is a void method java?