Source |
CodingSec |
Identifiant |
22047 |
Date de publication |
2016-09-06 19:00:31 (vue: 2016-09-06 19:00:31) |
Titre |
How to use this keyword in java |
Texte |
In this article, we will look at the uses of this keyword in Java programs along with example Java code. this Keyword this keyword in Java is used to refer current object on which a method is invoked. Using such property, we can refer the fields and other methods inside the class of that object. The this keyword has two main uses which are listed below: It is used to eliminate ambiguity between fields and method parameters having the same name. It is used for chaining constructors. To explain the first use, let's consider the following program, which creates a
|
Envoyé |
Oui |
Condensat |
along ambiguity appeared are article below: between can chaining class code coding consider constructors creates current eliminate example explain fields first following has having how inside invoked java keyword keywordâ let listed look main method methods name object ofâ this other parameters post program programs property refer same security such two use used uses using which will |
Tags |
|
Stories |
|
Notes |
|
Move |
|