Interview Question


Country: United States




Comment hidden because of low score. Click to expand.
2
of 2 vote

Quoting from Kate Serrias SCJP /OCJP book :

This issue can lead to a scenario known as the "Deadly Diamond of Death," because of the shape of the class diagram that can be created in a multiple inheritance design. The diamond is formed when classes B and C both extend A, and both B and C inherit a method from A. If class D extends both B and C, and both B and C have overridden the method in A, class D has, in theory, inherited two different implementations of the same method. Drawn as a class diagram, the shape of the four classes looks like a diamond."

Hence it was avoided in Java

- acJavaFreak August 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The problem with multiple inheritance is that: two classes may have different function definition but same function declaration, ie same what to do but different how to do it.
The subclass gets confused in picking the function.

Interfaces specify only what the class is doing, not how it is doing it.

- Prithvi August 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Java is a single inheritance language. All classes inherit java.lang.Object, when inherit from multiple parents, members will conflict. Java doesn't like Eiffel which has strategies to solve these conflicts.

- Will August 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

DUMB question to ask.

Answer is it's not in the language standard, so a compiler/VM maker can't implement it if they want to claim their thing is Java.

- bigphatkdawg September 19, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Thats why they provide interfaces.

- Ram August 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 3 vote

Designer's of Java thought that's no worth!!

- Varun August 17, 2013 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More