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

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

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

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
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
Meaning of invoice
Meaning of invoice  hello, What is the meaning of invoice?   hii,ADS_TO_REPLACE_1 Invoice is a statement which contains the following listed things. Invoice Number Invoice dateADS_TO_REPLACE_2 Name and address
what is the meaning of abstract?
what is the meaning of abstract?  what is the meaning of abstract
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
ModuleNotFoundError: No module named 'meaning'
ModuleNotFoundError: No module named 'meaning'  Hi, My Python... 'meaning' How to remove the ModuleNotFoundError: No module named 'meaning... to install padas library. You can install meaning python with following command
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
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
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 special meaning of __sleep and __wakeup?
What is 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
What is this keyword?
What is this keyword?  What is this keyword
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 the meaning of Java Platform?
What is the meaning of Java Platform?  Hi, Java is is very popular there are many requirements of Java Developer. I want to understand the difference between Java Platform and simple Java. What is the meaning of Java Platform
ModuleNotFoundError: No module named 'name-meaning'
ModuleNotFoundError: No module named 'name-meaning'  Hi, My Python... 'name-meaning' How to remove the ModuleNotFoundError: No module named 'name-meaning' error? Thanks   Hi, In your python
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
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
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
Java keyword
Java keyword  Is sizeof a keyword
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
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
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
final keyword
final keyword  why is final keyword used in java
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
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
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
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
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
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
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
Case Java Keyword
Case Java Keyword       The java keyword "case" is used to label each branch in the switch statement in java program. In other word Case is a java keyword
super Java Keyword
super Java Keyword       The super is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant
The implement keyword
The implement keyword       In java programming language, the keyword implement specifies... which have specific meaning relevant to a compiler. Syntax: Here is the syntax
static keyword
static keyword  please give some detail about Static keyword.   Static Variables Static variables are class variables that are shared by all instance of class .. 1)It is a variable which belongs to the class
SQL as Keyword
SQL as Keyword       The SQL Key word used in SQL are createTable,Insert into,select,delete... use various keywords like, create table keyword is used to create a table
DECESION MAKING STATEMENTS
DECESION MAKING STATEMENTS  The Decision Making statements may be implemented in different forms depending on the complexity of the condition to be tested. Describe various forms of decision making statements in java
static keyword with real example
static keyword with real example  static keyword with real examplestrong text
Java Control Statements
Java Control Statements     ... the control statements. Different types of control statements: the decision making statements (if-then, if-then-else and switch), looping statements (while, do-while
Return Java Keyword
Return Java Keyword       The return is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler
The null keyword
The null keyword       The null keyword in java programming language is a reserved word that is used... meaning relevant to a compiler. Syntex:  Here is the syntax that displays
The INSERT INTO Statements in SQL?
The INSERT INTO Statements in SQL?  The INSERT INTO Statements in SQL?   Hi, The INSERT INTO statement is used to insert a new row or multiple rows into a table.ADS_TO_REPLACE_1 SQL INSERT INTO Syntax INSERT
throws Java Keyword
throws Java Keyword       throws " is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler
The final Keyword
The final Keyword       The final is a keyword. This is similar to const keyword in other languages. This keyword may not be used as identifiers i.e. you cannot declare
Protected Java Keyword
Protected Java Keyword       protected is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler
general syntax for a SELECT statements
general syntax for a SELECT statements  Write down the general syntax for a SELECT statements covering all the options   Hi, The general..._TO_REPLACE_1 this syntax shows how we can use different optin with the select statements
static Java Keyword
static Java Keyword       The static is a keyword defined in the java programming language. Keywords are basically reserved words which have specific meaning relevant to a compiler

Ads