This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes A query about this variable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A query about this variable?" Watch "A query about this variable?" New topic
Author

A query about this variable?

Marium Hasan
Greenhorn

Joined: Oct 03, 2001
Posts: 12

Hello,
Can anybody knows that this variable can access static
members. If so,can this variable access them before creating
object or after creating.
plz reply
Regards
Marium
Kris Nelson
Ranch Hand

Joined: Nov 04, 2001
Posts: 35
Marium,
Static members can be accessed by any instances of the class, so because "this" refers to the current instance, it CAN access the statis members of a class.
As for your second question, I'm not sure how you can use "this" in an object before it is created. You'll have to elaborate that question (probably with an example, code, etc.).

------------------
WebNelly.com
Java/XML Web Development
Check it out!
http://www.webnelly.com


WebNelly.com<br />Java/XML Web Development<br />Check it out!<br /><a href="http://www.webnelly.com" target="_blank" rel="nofollow">http://www.webnelly.com</a>
Marium Hasan
Greenhorn

Joined: Oct 03, 2001
Posts: 12

Thanks Kris
I got my answer. I just want to confirm whether
this variable can access static member before creating object
which is not possible.
Thanks again for the reply,
Marium
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A query about this variable?
 
Similar Threads
Reg : static and volatile
Master exam question
Having problem with declaration of an object......
static constructors?
Private variable problem