Value type and Reference type in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Value type and Reference type in java?

Hi all, Just had a doubt ,is pass by value same as "Value type" and pass by reference same as "Reference type".Value type and reference type is a sub chapter in java in Sololearn. Thanks

22nd May 2019, 12:13 PM
swali1
5 Answers
+ 1
Value type are all the types which with a lowercase letter (e.g. int, float, boolean, ...). When they are passed to a function their value is given to function and thus if they are in changed in the function, the change won't be visible outside the function. Reference types are all the other types. When passed to a function, the reference (or pointer) to the object is passed by value (Java is always passed by value) but since you use a reference to access the object, the modification will be visible outside the function
22nd May 2019, 12:27 PM
Paul
+ 1
thanks -swim- and Paul
22nd May 2019, 12:32 PM
swali1
+ 1
ok ..got it -swim-
22nd May 2019, 12:47 PM
swali1
0
is "call by reference"="pass by reference"="reference types" and is "call by value"="pass by value"="value types"
22nd May 2019, 12:31 PM
swali1
0
btw can you refer to me a good article ,or thread or post or video ...on this concept of pass by value and pass by reference..it would be really helpful
22nd May 2019, 12:54 PM
swali1