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 Programmer Certification (SCJP/OCPJP) and the fly likes static 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static" Watch "static" New topic


arivu mathi
Ranch Hand

Joined: Jun 26, 2006
Posts: 38
can we use this reference inside a static method or a class?
can we use static and native together?
can anyone explain this?
Arafat Nalkhande
Ranch Hand

Joined: Jul 20, 2006
Posts: 51
We cannot use 'this' refernce inside the static methods.
Reason for it is that 'this' belongs to an instance whereas static stuff does not belong to any particular instance, but to the class in general.

I want to be myself, but a better myself.<br />~ SCJP 1.4 (91%), SCWCD 1.4 (86%) ~
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
this is non static and cannot be refered from static context.
A method can be both native and staic.
I agree. Here's the link:
subject: static
It's not a secret anymore!