What are the six ways to use this keyword?
Answer / Pravesh Kumar Kashyap
In Java, the 'this' keyword can be used: 1) To refer to the current object, 2) To invoke the current class constructor, 3) In method arguments to call overloaded methods, 4) To invoke a constructor of the same class, 5) As an argument in a constructor call of the superclass, and 6) Inside static methods to access non-static variables or methods.
| Is This Answer Correct ? | 0 Yes | 0 No |
Difference between the paint() and repaint() methods?
Should database connections be singleton?
how can we use the servlet as standalone apllication?should we need to extend any class?
How do I start learning java?
What are the different types of java?
What is the purpose of a parameter?
Why java is made?
If a variable is declared as private, where may the variable be accessed?
What is constructor chaining and how is it achieved in java?
What are virtual methods?
What is the transient keyword?
Difference between notify() method and notifyall() method in java?