In Java, all method arguments are passed using call by value, even when passing objects. However, this behavior often leads to confusion because object references allow indirect changes to the object’s internal state, mimicking call by reference.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
void reassign(Object obj) { obj = new Object(); } Object myObj = new Object(); reassign(myObj); System.out.println(myObj.hashCode());
Correct
Incorrect
Summary
Java uses call by value to pass arguments, including object references. While primitives remain unchanged, object states can be modified through copied references, often confusing developers about whether Java supports call by reference. Understanding this helps write safe and predictable Java code.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.