Dear Anton,
The compiler provides a default compiler only
when you have not declared any constructors..
The Constructor is used to instantiate a class.
So only if you haven't declared any compiler then
compiler will provide one so that yopu still can
instatntiate that particular class..
And imagine a class(Student) with a property name..
and if you have a function which sets the name for
the instance of that student class
like
private void setName(name:String)
{
name = name ; // this will give an error because the
local variables have more priority
so both name refers to local Variable
this.name = name ; // this is correct because the keyword
this refers to the instance of that
particular class so this.name is the
property of that class and the second
name is the argument passed into the
method
}
Hope this helps you
Regards
Sudhi
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---