What If we make the method as abstract in another Interface ?<br/><br/>public interface DefaultMethodInterface {<br/> default public void defaultMethod(){<br/> System.out.println("DefaultMethodInterface"); <br/> }<br/>}<br/><br/>public interface DefaultMethodInterface2 { <br/> public void defaultMethod(){<br/> System.out.println("DefaultMethodInterface2"); <br/> }<br/>}<br/><br/>public class HelloJava8 implements DefaultMethodInterface,DefaultMethodInterface2 {<br/> public static void main(String[] args){ <br/> DefaultMethodInterface defMethIn = new HelloJava8();<br/> defMethIn.defaultMethod();<br/> }<br/>} }
}

public interface DefaultMethodInterface2 {
public void defaultMethod(){
System.out.println("DefaultMethodInterface2");
}
}

public class HelloJava8 implements DefaultMethodInterface,DefaultMethodInterface2 {
public static void main(String[] args){
DefaultMethodInterface defMethIn = new HelloJava8();
defMethIn.defaultMethod();
}
}"> }
}

public interface DefaultMethodInterface2 {
public void defaultMethod(){
System.out.println("DefaultMethodInterface2");
}
}

public class HelloJava8 implements DefaultMethodInterface,DefaultMethodInterface2 {
public static void main(String[] args){
DefaultMethodInterface defMethIn = new HelloJava8();
defMethIn.defaultMethod();
}
}">
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. What If we make the method as abstract in another Interface ?

public interface DefaultMethodInterface {
default public void defaultMethod(){
System.out.println("DefaultMethodInterface");
}
}

public interface DefaultMethodInterface2 {
public void defaultMethod(){
System.out.println("DefaultMethodInterface2");
}
}

public class HelloJava8 implements DefaultMethodInterface,DefaultMethodInterface2 {
public static void main(String[] args){
DefaultMethodInterface defMethIn = new HelloJava8();
defMethIn.defaultMethod();
}
}
Ans. Even then the Compiler will give error saying that there is a conflict.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java8   default methods


Related Questions

  What is a Lambda Expression ? What's its use ?
  Difference between final and effectively final ? Why is effectively final even required ?
  What is StringJoiner ?
  Difference between Predicate, Supplier and Consumer ?
  What are few of the Annotations pre defined by Java?
  Name few meta-annotations ?
  Does java allow implementation of multiple interfaces having Default methods with Same name and Signature ?
  What are Default Methods ?
  Can we use static method definitions in Interfaces ?
  What is the use of Optional ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: