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



Subscribe to Tutorials

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. This code works for me. But i have a doubt how to
View Tutorial          By: Daya at 2015-05-04 12:04:19

2. I have compiled by keeping all the points in mind
View Tutorial          By: Sweety at 2011-03-09 22:29:18

3. I need full code for how to connnect pc to mobile
View Tutorial          By: Vijay at 2009-08-23 23:38:05

4. Can some body throw more light on TRANSIENT ....
View Tutorial          By: Anish at 2010-08-03 07:30:58

5. it is gooo...very helpful to know the basics
View Tutorial          By: srikanth at 2010-08-24 00:38:57

6. Please help .... I can't access this code. so any
View Tutorial          By: Sonu Kumar at 2014-02-26 11:31:08

7. Please guys i need sms.zip. I tried SMS.RAR but al
View Tutorial          By: Waseem at 2010-03-06 15:48:40

8. Hi,
I'm studying core java.java is new for

View Tutorial          By: shantkumar at 2011-12-01 17:02:26

9. Aoa. could anybody guide me about jsf with hibern
View Tutorial          By: imtiaz afridi at 2011-12-03 12:19:04

10. It's very easy to learn try / catch functionality.
View Tutorial          By: Ponraj at 2013-01-31 04:21:06