Generics in Java | #11 | Type Erasure in Java Generics | Bridge Method | Ambiguity Error | In Java

preview_player
Показать описание


Watch the complete web series "Java & Web" on YouTube. It's complete, comprehensive and conceptual.

Follow me on:

#JavaAndWeb #GenericsInJava #OCJP #SCJP #javatutorialforbeginners #javainterviewquestionsandanswersforfreshers #javainterviewquestionsandanswers #javaprogramming
Рекомендации по теме
Комментарии
Автор

What a pro. explanation, thank you sir!

hros
Автор

Sorry, didn't get why a compiler creates a bridge method....cause...when we have a paramitrized class a compiler assumes an object as a generic type and when we extands classes it ends up with two methods with different types of returning data so it creates an original "bridge" method to handle this situation...am i at least close to understanding?:-)

alvinchipmunk
Автор

The bridge method:

I don't see how the Object getobj() calls String getobj().

Inside Object
like the following? But this doesn't make sense. Object getobj() always return an Object. Not a String.

Object getobj(){
getobj();
}

HenryLeu