This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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.
wood burning stoves
subject: static
Similar Threads
how counter variable works in jsp
Why calling super to reach a static member is ALWAYS illegal?
static block