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

Java program to get location meta data from an image

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

Archived Comments

1. hi! this coding is very helpful for me thanks .
View Tutorial          By: bhuvaneshwari at 2009-10-18 23:52:58

2. awesome. thanks for the info
View Tutorial          By: Darren at 2010-05-09 19:55:22

3. yesh this is very help full for every body.
View Tutorial          By: venkat at 2010-06-29 12:18:57

4. pls give me example of stack class with postfix me
View Tutorial          By: uchiha at 2011-09-16 04:02:57

5. This is a good tutorial. Now how can I send SMS mu
View Tutorial          By: Alkesh at 2013-05-11 14:51:53

6. I'm having trouble figuring out how to sign my mid
View Tutorial          By: Patrick Somers at 2011-04-04 14:54:45

7. Answer for comment 5
this loop is work infi

View Tutorial          By: salman at 2013-03-10 07:30:53

8. Hey is there any way to export datagrid to crystal
View Tutorial          By: Anu at 2009-05-08 13:11:48

9. It is an excellent article. Please keep up the goo
View Tutorial          By: sanjay at 2011-03-09 03:17:45

10. can any body help me how to execute this code ....
View Tutorial          By: nikhil at 2009-06-04 23:10:30