(这)在java中 [英] (this) in java

查看:81
本文介绍了(这)在java中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

java中的'this'一词是什么意思?在此先感谢。





例子;



What does the word 'this' in java means? Thanks in advance.


Example;

mSensorManager.unregisterListener(this);

推荐答案

这是对当前对象的引用。有关详细信息,请查看此处 [ ^ ]
This is a reference to the current object. For more info check here[^]


此关键字始终引用类的当前实例或者您可以说当前对象。

您可以以下面给出的任何方式使用它。

a)您可以使用它来克服实例变量隐藏。 br />
b)您可以使用它来引用任何方法中的当前对象。

c)您可以使用它将对象作为参数传递给另一个方法。

d)你可以用它来调用同一个类中的另一个构造函数。



和详细信息你可以导航给定的链接

此关键字 [ ^ ]
This Keyword is always refer to current instances of classes or you can say current object.
you can use this in any way as given below
a) you can use this to overcome to instance variable hiding.
b) you can use this to refer current object inside any method.
c) you can use this to pass object as a parameter to another methods.
d) you can use this to invoke another constructor in same class.

and for details you can navigate the given link
this Keyword[^]


所以在这种情况下,哪个四个选项是'this'这个词用作?



a)你可以用它来克服实例变量隐藏。

b)您可以使用它来引用任何方法中的当前对象。

c)您可以使用它将对象作为参数传递给另一个方法。

d)您可以使用它来调用同一类中的另一个构造函数。







So in this case, which of the four options is the word 'this' being used as?

a) you can use this to overcome to instance variable hiding.
b) you can use this to refer current object inside any method.
c) you can use this to pass object as a parameter to another methods.
d) you can use this to invoke another constructor in same class.



@Override
   protected void onPause(){
       if (theRegisteredSensor){
           theSensorManager.unregisterListener(this);
           theRegisteredSensor = false;
       }
       super.onPause();
   }


这篇关于(这)在java中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆