Recently today I asked how to use processing with HTML, and you guys helped a lot. But now, I have another question. I have seen code like this:
I am seriously confused on what (this.) does, and processing.org did not help at all. Can somebody explain?
Thanks, and have a great day!
this refers to
this instance of an object in java. For example, if you say, extended JFrame and wanted to call it's methods, you could do something like
setVisible(true); but that is not a good practice.
this can be used to call its methods and is much neater like this:
Hope this helps! :)
It removes ambiguity. According to @Coder100
Shoot, idk what ambigutiy means, i probably used that word incorrectly help
Ok, so basically this is a Java thing, you will need to learn more java.
Anyways, it refers to a variable defined inside a
class instead of the current variable: