Qus:    What are the advantages of passing this into a method instead of the current class object itself?
Feb 24, 2021 11:36 1 Answers Views: 423 RANJIT
Prev Next
Answers (1)
JOSHUA Feb 25, 2021 09:15
Answer:   As we know, that this refers to the current class object, therefore, it must be similar to the current class object. However, there can be two main advantages of passing this into a method instead of the current class object.
o this is a final variable. Therefore, this cannot be assigned to any new value whereas the current class object might not be final and can be changed.
o this can be used in the synchronized block.

Post Your Answer
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect