venkateshmadisetty
meaning of "this" keyword in statements addActionListener(this)
1 Answer(s)      3 years and 3 months ago
Posted in : Java Beginners

meaning of "this" keyword in statements addActionListener(this)?

Advertisement
View Answers

May 8, 2012 at 1:18 PM


Basically, this keyword is used to refer the current instance of the method on which it is used. In the specified statement, object b1 is making a method call addActionListener in which the argument passed is the method invoking object it self which is represent by "this" ie "this" refers to the b1.

In other words, "this" represents the action listener is defined in the same class itself not outside the class. It means your class has implemented the interface ActionListener, therefore this statement is needed.










Related Tutorials/Questions & Answers:
Keyword - this
Keyword - this       A keyword is a word having a particular meaning to the programming language. Similarly, this keyword is used to represent an object constructed from a class
problem with addactionlistener on JComboBox - Java Beginners
problem with addactionlistener on JComboBox  ViewElements.java:225: expected jccourse.addActionListener(new ActionListener.... You can use addActionListener() on Combo Box in the following way: import
Advertisements
Meaning of invoice
Meaning of invoice  hello, What is the meaning of invoice?   hii, Invoice is a statement which contains the following listed things. Invoice Number Invoice date Name and address of the person Name and address
what is the meaning of abstract?
what is the meaning of abstract?  what is the meaning of abstract
The else Keyword
The else Keyword        The else is the one more keyword of Java. It is used to specify a statement or block of statements that are executed when the condition for testing specified
what is the meaning this coad?
what is the meaning this coad?  what is the meaning this coad? Example Form example form = (Example Form) form
MEANING OF THe CODE IN BOLD LETTERS
MEANING OF THe CODE IN BOLD LETTERS  public static void main(sting args[]) { shape s[] = {new circle(),new rectangle()}; } //HERE SHAPE RECTANGLE AND CIRCLE ARE THREE CLASSES WHICH ARE DEFINED EARLIER IN THE PROGRAM
what is the meaning of this or explain this
what is the meaning of this or explain this  List<Object[]> list=query.list();   Hi Friend, It will return the query values in the form of list. For more information, visit the following link: Hibernate
What is the special meaning of __sleep and __wakeup?
What is the special meaning of __sleep and __wakeup?  What?s the special meaning of _sleep and _wakeup
The if Keyword
The if Keyword         The if is a keyword, which is used to perform the selection statement. It is used to execute the statements after evaluating the condition
predicates and statements?
predicates and statements?  Explain about predicates and statements
The for Keyword
The for Keyword       The for is Java keyword that is used to execute a block of code continuously to accomplish a particular condition. The for loop specifies the statements
What is this keyword?
What is this keyword?  What is this keyword
What?s the special meaning of __sleep and __wakeup?
What?s the special meaning of __sleep and __wakeup?  What?s the special meaning of _sleep and _wakeup
try Java Keyword
try Java Keyword       The try is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java
Java keyword
Java keyword  Is sizeof a keyword
The While keyword
The While keyword       While is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java
The void keyword
The void keyword       The void is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler in java
this java keyword
this java keyword       "this" is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler
super keyword
super keyword  super keyword explain
synchronized Java Keyword
synchronized Java Keyword       The synchronized is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning
final keyword
final keyword  why is final keyword used in java
The volatile keyword
The volatile keyword       The volatile is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler
while Java Keyword
while Java Keyword       The while is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant
transient keyword
transient keyword  how to use transient keyword?   Hi Friend, The transient keyword is used to indicate that the member variable should not be serialized when the class instance containing that transient variable
true Java Keyword
true Java Keyword       The true is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler
volatile Java Keyword
volatile Java Keyword       The volatile is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant
Return keyword
Return keyword  how do we use return in methods?   Java use of return keyword import java.util.*; public class ReverseString{ public... at Return Keyword
void Java Keyword
void Java Keyword       The void is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler
transient Java Keyword
transient Java Keyword       The transient is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant
Dynamic keyword
Dynamic keyword  hi....... What is the dynamic keyword used for in flex? give me the answer ASAP Thanks  Ans: Dynamic keyword... during the run-time. Just add the magic keyword dynamic to the class definition