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
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 24061
    
  13

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 ]

Jason's Blog
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: can interfaces have methods which are declared abstract
 
Similar Threads
difference between interface and abstract classes
Interfaces Vs Abstract Classes
Abstract Classes Vs Interfaces
Abstract, Interfaces!
interface/interface's method declaration