File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes May I know the difference between a & this.a? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "May I know the difference between a & this.a?" Watch "May I know the difference between a & this.a?" New topic
Author

May I know the difference between a & this.a?

WhoLetsTheDogsOut
Greenhorn

Joined: Jan 17, 2001
Posts: 4
May I know when to use
int a=9;
and
this.a=10;
Robert Z
Greenhorn

Joined: Jan 18, 2001
Posts: 5
in a = 9
this.a = 10
this can be useful when u have a public data member a

when u want to set this variabele u can use a function
like setA(int a)
{
this.a = a;
}
this.a refers to the a on the current object class
and a is a local var which scope is during lifetime function setA
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: May I know the difference between a & this.a?
 
Similar Threads
What is a class and object?
How to set class or object variables?
Is this a Java Program?
Struts Action Forms - Struts in Action Book
Can I set object variable in a constructor?