What are the six ways to use this keyword?



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

Post New Answer

More Core Java Interview Questions

Difference between the paint() and repaint() methods?

1 Answers  


Should database connections be singleton?

1 Answers  


how can we use the servlet as standalone apllication?should we need to extend any class?

2 Answers   Logica CMG,


How do I start learning java?

1 Answers  


What are the different types of java?

1 Answers  


What is the purpose of a parameter?

1 Answers  


Why java is made?

1 Answers  


If a variable is declared as private, where may the variable be accessed?

1 Answers  


What is constructor chaining and how is it achieved in java?

1 Answers  


What are virtual methods?

1 Answers   TCS,


What is the transient keyword?

5 Answers  


Difference between notify() method and notifyall() method in java?

1 Answers  


Categories