Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (6.5k points)
Doesn't this refer to the current class object?

1 Answer

0 votes
by (11.3k points)

Yes, you are right, 'this' refers to the current class object. Despite this though, if you're looking to learn java, there are a couple of advantages of passing 'this' to a function and not the current class object. 

  • Since 'this' is a final variable, it cannot be assigned to a new value whilst the current class object may not be final and is susceptible to change. 
  • Its implementation can be used for a synchronized block. 

Browse Categories

...