in JAVA by
Q:
What are the advantages of passing this into a method instead of the current class object itself?

1 Answer

0 votes
by

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.

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.

this can be used in the synchronized block.

Click here to read more about JAVA
Click here to read more about Insurance

Related questions

0 votes
asked Dec 16, 2020 in JAVA by SakshiSharma
+1 vote
asked Jun 2, 2020 in JAVA by Indian
+1 vote
asked Feb 8, 2020 in JAVA by rahuljain1
0 votes
0 votes
asked Dec 23, 2020 in Informatica by SakshiSharma
0 votes
asked Oct 3, 2020 in Web Hosting by Robindeniel
...