aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes abstract/concrete methods and modifiers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "abstract/concrete methods and modifiers" Watch "abstract/concrete methods and modifiers" New topic
Author

abstract/concrete methods and modifiers

Damien Howard
Ranch Hand

Joined: Apr 01, 2003
Posts: 456
I know that certain modifiers can not be applied to abstract methods such as synchronized or native.
What about the concrete methods that imjplement the abstract methods? Can these use the modifiers?
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Check out the JLS, §8.4.3 Method Modifiers. It has all of the information you want and then some.


SCJP Tipline, etc.
Damien Howard
Ranch Hand

Joined: Apr 01, 2003
Posts: 456
It seems then that a concrete implementation of an abstract method could never be synchronized or written in a native language then.
Is that correct?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by Damien Howard:
It seems then that a concrete implementation of an abstract method could never be synchronized or written in a native language then.
Is that correct?

Where did you find that in the JLS? An abstract method can't be native but the implementation of an abstract method can be.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
Originally posted by Damien Howard:
I know that certain modifiers can not be applied to abstract methods such as synchronized or native.
What about the concrete methods that imjplement the abstract methods? Can these use the modifiers?

I think any modifier can be applied to concrete method as it is not abstract anymore.Correct me if I am wrong.
Veena


SCJP1.4
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
rahul V kumar
Ranch Hand

Joined: May 20, 2003
Posts: 82
If you mean this,
abstract class A
{
abstract void aMethod();
}
class B extends A
{
synchronized void aMethod(){ }
//native void aMethod();
public static void main(String[] arg)
{
}
}

then this code compiles without any issues.
 
jQuery in Action, 2nd edition
 
subject: abstract/concrete methods and modifiers