Explain pass by reference and pass by value?
Answer Posted / ganesh nagalingam
***In Java, primitives and object references are passed by
value.***
The variable represents the bit information which is copied
to the parameter.
eg:primitive****
Say for primitives x=2, the value of 2 is represented in
bits and it is copied to the parameter variable.
eg:object reference***
Button b = new Button("hello");
Button c = b;
Similarly for object reference the bit value in the
reference is copied to the parameter reference. Thus both
references have the same value representing an object. The
object reference(bit representation) represents a way to
get to the object.
Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
Differentiate jar and war files?
What does arrays sort do in java?
How many bits is a word?
What is byte code and why is it important to java’s use for internet programming?
How to connect to a remote database using Applet?
What is the basic concepts of OOPS?
What is linkedlist in java?
what is the purpose of using rmisecuritymanager in rmi?
What are access specifiers available in java?
What is the static field modifier?
Does java allow default arguments?
How do you trim a space in java?
What are the data types supported by java?
What is difference between Heap and Stack Memory?
What is the meaning of I ++ in java?