Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Can someone explain what "this" is in Java?


    Recommended Posts

    I know that I can just read up on the docs or find the answer by myself, but I'll learn far more if someone explains it in their own words -- and you'll also deepen your understanding by teaching. So I don't quite yet get it what this.variable = class.variable; is.

    Link to comment
    Share on other sites

    7 hours ago, Neffarion said:

    "this" just refers to a "variable" that is the reference of the current object, you can also use "this()" to use the current object constructor

    Honestly this is basic java, its better you just google search this. https://docs.oracle.com/javase/tutorial/java/javaOO/thiskey.html


    4 hours ago, yeeter01 said:

    Here is a guide I link a lot of people concerning "this".  Really big fan of Geeks For Geeks guides.  


    Thanks guys, from what I understand now it's a way to update the global variable that you initiated in the class; like int i; It's done not to confuse the compiler.


    public void test(int i){

    this.i = i;


    Link to comment
    Share on other sites


    This topic is now archived and is closed to further replies.

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.