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. You should add the mime type as follows:

View Tutorial          By: Anonymous at 2009-03-19 08:30:35

2. Good explanation, Thanks.
View Tutorial          By: bram at 2011-05-06 03:37:54

3. what is differences between application scope and
View Tutorial          By: suresh at 2013-05-13 13:03:12

4. Excellent article
View Tutorial          By: JJ at 2011-03-21 13:42:35

5. Hi,

I am using the code files for s

View Tutorial          By: Utsav at 2009-07-14 01:29:06

6. how come its able to copy from copyFrom to CopyTo.
View Tutorial          By: sameera at 2015-09-12 13:56:29

7. Very good.
But is this (Accessor functions

View Tutorial          By: peter at 2011-07-20 13:13:44

8. ma'am aiza teaches us very well.. >< i like
View Tutorial          By: chai at 2011-02-07 07:06:36

9. hi ..........
the code is worked for me....

View Tutorial          By: pradeep at 2012-01-25 06:30:14

10. plzzz xplain all d buzzwads.....
View Tutorial          By: sindhu at 2010-12-10 08:49:27