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

When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

740


Explain static nested classes ?

792


What are the advantages of defining packages in java?

721


What is the synonym of string?

763


What is a literal coding?

712


Name four container classes.

735


Will the jvm load the package twice at runtime?

803


What is an example of a conditional statement?

759


Explain the concept of proper inheritance?

803


Explain the private protected method modifier?

739


explain what is transient variable in java?

854


What about method local inner classes or local inner classes in java?

794


Which one of the following suits the description of a string better: derived or primitive?

706


What is the difference between state-based unit testing and interaction-based unit testing?

695


What if I write static public void instead of public static void in java?

801