This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes static,super&this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static,super&this" Watch "static,super&this" New topic



Joined: Feb 04, 2002
Posts: 6
please do help me on static , this and super . correct me if i am wrong. super method in a subclass hold the value of it's(subclass) immediate superclass. static methods belong to a class ,what does this mean.i do have a rough idea. but please clear me on this.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63542

geet, you'll be asked to change your name to the JavaRanch standards. Until then, in a nutshell:
this is a reference to the instance of the object that a non-static method is executing against.
super is a way to reference the superclass from which the current class is dervied. It could be used to differentiate between identifiers that are the same in the derived and super classes. When used as a method name in a constructor, it references the constructor of the superclass.
static is a keyword that specifies that a member or method does not "belong" to a specific instance of the class, but to the class as a whole. Hence, within a static method, there is no this.

[Asking smart questions] [About Bear] [Books by Bear]
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
This the second time I have asked you to read and comply with our naming policy here at the ranch.
Your account has been locked.
Please re-register and make sure your display name is an appropriate name as shown in the policy.
[ March 13, 2002: Message edited by: Dave Vick ]

I agree. Here's the link:
subject: static,super&this
It's not a secret anymore!