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 static data type in java?
What is difference between overloading and overriding in java?
How do you replace a string in java?
Why string is not a wrapper class?
How do you empty a list in java?
What is primitive array?
Is there a jre for java 11?
What is a parameter in simple terms?
Is void a type?
Can you create an object of an abstract class?
Write a regular expression to validate a password. A password must start with an alphabet and followed by alphanumeric characters; its length must be in between 8 to 20.
Why main() method is public, static and void in java ?
What is the difference between assignment and initialization?
Why convert an applet to an application?
What is an empirical question?