I know that this
refers to a current object. But I do not know when I really need to use it. For example, will be there any difference if I use x
i
Following are the ways to use ‘this’ keyword in java :
this
keyword to refer current class instance variablesthis()
to invoke current class constructorthis
keyword to return the current class instancethis
keyword as method parameterhttps://docs.oracle.com/javase/tutorial/java/javaOO/thiskey.html