Can a method inside a Interface be declared as final?

Ads
 

Can a method inside a Interface be declared as final?

Hi,

Can a method inside a Interface be declared as final?

Thanks,

View Answers

April 15, 2013 at 11:41 AM

Hi friend,

No, we can't declare a final method inside the interface. Doing so, the Java compiler will give the compilation error. This is because the methods declared inside the interface must have to implemented by its implementing class. Inside the interface only public and abstract modifier is allowed for declaring a method.

For more detail you can go through the following link

http://www.roseindia.net/java/master-java/interface.shtml

Ads









Related Tutorials/Questions & Answers:
Can a method inside a Interface be declared as final?
Can a method inside a Interface be declared as final?
Advertisements
Can a main method be declared final?
Can we declare a static variable inside a method?
Can a class be declared as protected?
Can a class be declared as static?
method inside the method??
Why is the main method declared static?
Can a abstract class be declared final?
What if the main() method is declared as private?
cannot declare variable inside @interface or @protocol
Can an Interface implement another Interface?
Can an Interface extend another Interface?
how can i define only one method from the interface. - Java Beginners
Should a main method be compulsorily declared in all java classes?
AsyncContext Interface dispatch method
Can a main method be overloaded?
can i Execute PHP code inside python script?
Can i use Scriptlets inside javascript,if so how?
can interface solve this problem in java
Interface in java with example
Interface
How can print integer in method
Interface in Java
In JSP page, inside a javascript function, can I place a java code using scriptlet tag?
interface
Why servletcontainer can,t call the Init() method ?
can we inherit static method in java?
interface
Java Interface
DOM importnode, Example of importnode method of document interface.

Ads