Java

8.22 Interface in Java 8 Default , Static Methods | New features



Practical :

Editing Monitors :

Editing Laptop :
ASUS ROG Strix – (new version)

Camera :
lens :

Mics

Check out our website:

Follow Telusko on Twitter:

Follow on Facebook:
Telusko :…

Similar Posts

49 thoughts on “8.22 Interface in Java 8 Default , Static Methods | New features
  1. I understood what the default method does for an interface but what's the difference between static and default methods..both sounded the same. Both enable the implementation of methods inside an interface. Could you please tell me whats the key difference between both? Much appreciated.

  2. If I've interface I and interface J and every interface exist show() method. but show() method of interface I is default. Now also I have C class which is implements interface I and J. how can i access show() method of interface J from C class?

  3. I have a question, so in Java 1.8 we can perform multiple inheritance by overriding a method so that it doesn't create confusion. Can't we apply the same to Java 1.7?

  4. with thius update to define methods inside a inteface i dont understand why interface exists then multiple inheritance should be directly allowed with class only.

  5. @FunctionalInterface

    public interface Comparator<T> {
    int compare(T o1, T o2);
    boolean equals(Object obj);
    .
    .
    .
    }

    How? You just said that we can't do that… and comparator not only has it, it also has 2 functions even if it is @FuncionalInterface

  6. Have a question related to diamond problem.. with interfaces like u said if I,J have same default method Show() then class C needs to override it in order to avoid the diamond prob. Same could be the solution for diamond problem with classes correct ?

  7. A question which I have in my mind is let's say now interface also allow default and static then what's the advantage of having interface in place of abstract class?

  8. This is the most comprehensive video I have ever seen on default and static keywords. So many details listed out with such a simple and evenly paced delivery! You, sir, are simply amazing!

  9. My doubt was tht interface has static and default method
    When to use interface and when to use abstract class as both are same now

    You are the only one who is telling the diff
    Thanks a lot

    But plz explain wat to use when

  10. As u mentioned if both the interface are having the same method name, we need to override that in calling class. Is there any other solution for that, like using InterfaceName.super.methodName(); ?

  11. I have one doubt. I am getting this error when implementing one interface and extending another class, I did defined the same show() method in interface and class as well, "The inherited method I.show() cannot hide the public abstract method in A"

  12. Hi Navin – One question is – What what is the thought process behind declaring a static method in an interface. Can you explain one such scenario – where it fits in?

  13. Please help me understand. Basically default methods had to be introduced only coz of additions of new methods in existing interfaces by Java developers. Hence now users too can define methods in interfaces if needed without affecting its implementing classes. Am I right?

  14. Hi.
    Please explain the difference between Abstract Class and Interface with reference to Java 8. As of now in the interface, we can also define methods with the default keyword.
    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *