Day 48 | Daily Java interview question | #java #ocjp #scjp

preview_player
Показать описание
Java programming interview questions
Java interview questions
Java tutorial
play with Java
learn Java
Java interface
Java 8 default method
Java method overriding
Java method overloading
springboot
struts
#scjp #javaprogramming #javainterviewquestion #javatutorial #learnjava #interview #javaquestions #javascript #ocjp #java #springboot
#javacertification #javaforall
Рекомендации по теме
Комментарии
Автор

Yes its big exception because compiler confused it happily compiles default concrete methods but in print() it collapse

crazycarrot
Автор

1)it won’t give Exception, will give Compile time error
2)For happy path we need to override print () method and if u want to call First interface method then add First.super.print()
3) if u want to call Second interface method then add Second.super.print

devkawde
Автор

We will get an exception Unrelated defaults for print() from types first and second

prakashp
Автор

Exception. Because interfaces only have abstract type methods not body as shown in picture. It should have been like this:
Interface first {
default void print();
}
Interface second {
default void print();
}
That's it.

reshmaranjan
Автор

C) Exception. Both method have same method name, compiler will confuse which method excute first

rajtangadi
Автор

Exception, inerface should have public methods

ItsTheTime
Автор

Exception to overrid the anyone default method to the chield class eithr from test1 or test2

thepositivesoch
Автор

We must override all the methods() in interface in child class

Jai-czph
Автор

Exception, Because interface can only container unimplemented method ().

lateefadedokun
Автор

Exception becouse it will give a ambiguity error

DipakChavan-tf
Автор

Ans: Exception

If test.First.print() -> First

_JackTheRipper
Автор

since both interface have same method signature "print()"
we are getting exception
if we change method signature for any of the interface it will work
print() - First
print(String str) - second

arekuti
Автор

Exception is the right ans. Bcz interface can only decalre methods, methods without body.

anujapopale