+ 2

Value and Reference types

Hello, I am new to java and am unable to understand the difference between the value and Reference types in classes. Can someone please describe it a bit clearly? Is it similar to the pass by value and pass by reference thing as in C, C++. Please elaborate.

26th Nov 2021, 3:44 AM
Ruchika Sehgal
Ruchika Sehgal - avatar
3 ответов
0
Java is pass-by-value
26th Nov 2021, 7:29 AM
Charles Jones
Charles Jones - avatar
0
Then can u please explain the difference between value and Reference types
26th Nov 2021, 4:12 PM
Ruchika Sehgal
Ruchika Sehgal - avatar
0
Ruchika Sehgal Their is no type difference between value and referenced. Not that I know of. The only difference is that Pass by value will create a copy *value* at a new memory address, while Pass by reference uses the same memory address of whatever was passed in.
27th Nov 2021, 3:56 AM
Charles Jones
Charles Jones - avatar