Advanced Java Question:
Download Questions PDF

Does Java pass arguments by value or reference?

Answer:

Pass by value.
1. When passing primitives, it passes a copy of the
variable to the method. Any change made in the method does
not reflect in the calling method.
2. When dealing with objects, a copy of their
reference/address is passed. Thus the change made to the
object is reflected in the calling method.

Download Advanced Java Interview Questions And Answers PDF

Previous QuestionNext Question
Will it be called overriding if I do not change the parameters or return type, instead throw a different exception in the method signature?Different between Struts and Spring? or Why use Spring, if you are already using Struts?