Why do we use this.A_Class

public class HexBoard extends Canvas implements MouseListener {
    public Matrix white = null;
    public Matrix black = null;
    public void init() {
        makeMove(0, this.white, this.black);
        this.white.setValue(20, 10, 1);
       //makeMove(0, white, black)
       //white.setValue(20, 10, 1);
}command code gives me the same result, what does "this" acturally do in java?

"this" is a reference to the object whose init() method is being invoked. You also see it used in constructors where it refers to the object being constructed.
Some people use it to make it clear that white as an instance variable as you observe it adds no meaning in that case. It is handy if white also occurs as an argument and in this case it does alter the meaning because there are two different variables involved and "this" differentiates between them:
public void init(Matrix white, Matrix black) {
        // "essential" use of this
    this.white = white;
    this.black = black;
    makeMove(0, this.white, this.black);
    this.white.setValue(20, 10, 1);
}

Similar Messages

Maybe you are looking for

  • How to configure Oracle Alerts For Sending EMail?

    Hi All, I am using Oracle Apps 12.1.1. I am configuring Oracle Alerts to sent a email. for that i have set Unix send mail :/usr/lib/sendmail Mail Database/Server Name:172.16.0.6 Mail Priority:Normal In Accounts: User Name:My User Name Password:******

  • Crystal Reports XI - Installation on Server 2008 r2

    I have moved an installation of of Crystal reports from our Windows 2000 machine onto our Server 2008 R2 machine (x64) and am having difficulties getting the program to work. It installs fine, I choose a custom install and selected all components to

  • Regarding Database Performance

    Hi All, I have installed *10gR2 on RHEL4 (4GB -- RAM, space is enough)*. One application (oracle ucm) is running on that. Its contains apache and content server. After 2-3 weeks, developers were saying taking long time for opening url. So done gather

  • How to determine the congestion of a website

    I want to know whether is there anyway to determine the congestion of the website? I'm tyring to do the animation on the web browser. It will run while it is loading and it will stop when it is done. Does anyone has any idea on how to get the speed o

  • Does DNG Converter 5.6 Alter WB Info of DMC-LX3 RW2s?

    I have converted a Panasonic DMC-LX3 generated ".RW2" to DNG using DNG Converter 5.6 for the exclusive purpose of being able to open it in the current version (2.1040) of Rawnalyze. The conversion prodeeds OK, and I am able to view the resulting DNG