clarification of “this” keyword in Java

后端 未结 5 1243
陌清茗
陌清茗 2021-01-19 15:17

I have this code copied from Android developers website:

public class ExampleActivity extends Activity implements OnClickListener {
    protected void onCrea         


        
5条回答
  •  广开言路
    2021-01-19 15:56

    "this" is a reference to the current object.

    In your case, it refers to an instance of the ExampleActivity class.

    http://download.oracle.com/javase/tutorial/java/javaOO/thiskey.html

提交回复
热议问题