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 about Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "about "this "" Watch "about "this "" New topic
Author

about "this "

lang lang
Greenhorn

Joined: Nov 01, 2003
Posts: 8
I'm a Java beginer.Now I'm confused about "this ",would you please tell me
about "this "in different aspects? If you add some examples ,I will be greatful.
thanks a millon!
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

"this" is a referance to the current object.


Please ignore post, I have no idea what I am talking about.
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
I think this might too explain what this means
Say if you have a class like this
public class Test {
int x = 0;
public Test(int x) {
x = x;

}
}
So how to deferenciate the two x's which one is global and one is local?
you can say
this.x = x;
now the 'this.x' is the global variable and x, which is assigned to it is the local variable.
Hope it is clear.


SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: about "this "
 
Similar Threads
Hi to all
which framework is best for me?
Applet does'nt refresh itself???
wish
gc?