File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes can interfaces have methods which are declared abstract Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can interfaces have methods which are declared abstract" Watch "can interfaces have methods which are declared abstract" New topic
Author

can interfaces have methods which are declared abstract

Chandra Bairi
Ranch Hand

Joined: Sep 12, 2003
Posts: 152
can interfaces have methods which can be declared with the keyword abstract.
i read a book which says that the keyword is superflous and would not compile does the code get compiled
for me it is compiling properly


Thanks,
Shekar
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Section 9.4 of the Java Language Specification says

For compatibility with older versions of the Java platform, it is permitted but discouraged, as a matter of style, to redundantly specify the abstract modifier for methods declared in interfaces.


[Jess in Action][AskingGoodQuestions]
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
The keyword does appear to be superfluous. A class implementing an interface with such a method will compile fine even if it makes the method concrete.
[ November 13, 2003: Message edited by: Jason Menard ]
 
wood burning stoves
 
subject: can interfaces have methods which are declared abstract