Comment on Tutorial - this keyword in Java By Jagan



Comment Added by : Al Scherer

Comment Added at : 2009-09-15 09:33:24

Comment on Tutorial : this keyword in Java By Jagan
I'm sorry but your closing statement...

"this is of no significant value in the examples just shown..."

... is not quite right. "this" is mandatory in your last code snippet (at least with Sun's Java 6). If you leave out the "this" references, you are actually assigning the constructor parameter values to the constructor's local variables - not to the instance variables.

And, to follow best practices, we'd make the arguments final so that, if we forgot the this's, the compiler would call it out for you.


View Tutorial



Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. it is very useful and in understandable manner
View Tutorial          By: Deepika at 2012-03-26 05:10:15

2. great answer...
View Tutorial          By: nagi ponnagani at 2011-04-29 14:11:21

3. Use (JavaScript) below code to display client dat
View Tutorial          By: pmprash at 2009-12-22 01:15:33

4. Thank you, this tutorial is well-written and made
View Tutorial          By: Adrien Tétar at 2012-10-28 19:01:57

5. nice
View Tutorial          By: utkarsh at 2015-03-10 03:18:26

6. Hi all
I connected my mobile wi

View Tutorial          By: sruthy at 2010-07-07 03:44:27

7. thanksssssssssssss
View Tutorial          By: gajender sharma at 2015-02-02 09:15:05

8. please provide Example instanceof With Collection
View Tutorial          By: siddardha at 2010-08-18 00:30:38

9. It's simply nice.
View Tutorial          By: ghani at 2011-07-01 07:18:35

10. Very simple and easy to understand... Thank u...
View Tutorial          By: Anu Priya at 2013-07-22 09:00:19