The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static and abstract Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static and abstract" Watch "static and abstract" New topic

static and abstract

sri rallapalli
Ranch Hand

Joined: Mar 15, 2005
Posts: 88
why is it not possible to declare a method both static and abstract?
thanks in advance,
Seenu Reddy
Ranch Hand

Joined: Apr 03, 2002
Posts: 108
sri rallapalli,

Static method can't override in sub class. But abstract methods ment to override.

Tip: Abstract method should not have any other non access modifier.


Thanks,<br />Seenu<br />SCJP1.4,SCBCD1.3,Next-->SCWCD1.4
Liviu Carausu
Ranch Hand

Joined: Oct 07, 2004
Posts: 159

Tip: Abstract method should not have any other non access modifier.

And not even all access modifiers : "private" is not allowed for the same reason: "abstract" is ment to be overriden , which is not possible for private methods

Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer.
Philip Heller
Ranch Hand

Joined: Oct 24, 2000
Posts: 119
Sometimes I've wanted an abstract synchronized method, to enforce synchronized behavior on all subclasses, but the compiler won't let me. I can imagine heavy-duty number crunchers wanting to create abstract strictfp methods, again to enforce behavior on all subclasses, but again it's illegal.

Consultant to SCJP team.<br />Co-designer of SCJD exam.<br />Co-author of "Complete Java 2 Certification Study Guide".<br />Author of "Ground-Up Java".
I agree. Here's the link:
subject: static and abstract
It's not a secret anymore!