1. How is Java’s behavior similar to pass-by-value in C++? How is it different?
2. How is Java’s behavior similar to pass-by-reference in C++? How is it different?
Question No 1:
Similar:
In both C++ and JAVA when passing by value we are only passing the datatype variable which we are seeing on front. In both we are actually making a copy of that datatype variable data
Difference:
In JAVA the value you are passing can be a reference but in C++ it is always a value.
Question No 2:
Similar:
Both have reference combability thoroughly . Both Java and C++manipulate objects by reference.
Difference:
In C++ pass by reference is completely different and in JAVA it is always pass by value.
We use & in C++ refereeing to a reference however in JAVA there's no such thing
IF YOU HAVE ANY QUERY PLEASE COMMENT DOWN BELOW
PLEASE GIVE A THUMBS UP
Get Answers For Free
Most questions answered within 1 hours.