开发者

java programming language [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this que开发者_JAVA百科stion so that it can be reopened, visit the help center. Closed 12 years ago.

what is 'this' keyword and what's its functions?


The this keyword refers to the current object in the context in which the keyword appears.

Here's an article with more: http://www.quirksmode.org/js/this.html


In Java this refers to the object you are currently in. See http://download.oracle.com/javase/tutorial/java/javaOO/thiskey.html

In JavaScript that is true as well, but in a function it can mean the "owner" of a function or the global object (ie window). See http://www.quirksmode.org/js/this.html


The this refers as to the object you are currently in. For example, if your object has a method called doSomething(), you could call the method , from another method in your class by doing:

this.doSomething();

Hope this helps.


this refers to the current object, so its methods are those defined by the class that the current object is an instance of.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜