CAN SOMEONE PLEASE explain the this. keyword in java to me?

  • Context: Comp Sci 
  • Thread starter Thread starter kirkulator
  • Start date Start date
  • Tags Tags
    Explain Java
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
kirkulator
Messages
32
Reaction score
0
CAN SOMEONE PLEASE explain the "this." keyword in java to me?!

"the this keyword can be used to refer to the calling object or used inside one constructor to invoke another in its own class.

I understand how it invokes another constructor. But i do not understand why i keep seeing this code within methods of class'.

When should i use this keyword? When i have multiple objects in a class, and what does it even mean when I am typing it?

Im so confused and my professor refuses to explain. Thanks so much,

Amanda
 
Physics news on Phys.org