Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 153 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Take a look at this particular question. It's asking something reasonable in my mind; I feel that the confusion stems from a misunderstanding of what an interface is, and what it's meant to provide.

There are reasonable answers for it, and it's clear as to what the question is asking (just let me get out my ol' Strunk & White and it'll be as good as new). Why should this question have been closed?

share|improve this question
A person trying to understand something will get further with "I don't understand x" than with "x has a fatal flaw" – Kate Gregory Oct 14 '13 at 3:17
I don't disagree...but does that really mean that the question should be closed as "unclear what you're asking"? The question is clear, and the confusion is apparent, and it can be reasonably answered. – Makoto Oct 14 '13 at 3:21
But @Makato, because I don't think interfaces have a fatal flaw, I really couldn't tell what the OP was asking. When you write "I don't understand" you have to lay it out in more detail. – Kate Gregory Oct 14 '13 at 12:36
up vote 6 down vote accepted

The original question was not clear, so it was closed.

Java Interface - Fatal Flaw

Suppose we have an interface A, being implemented by class B. If programmers consistently use type A every time an instance of B is referred to, then any method, say m, defined in B but not specified in A is hidden and cannot be accessed by any code holding a reference of type A. There is a fatal flaw in this argument. How can a piece of code referring to an instance of B (with type A) can in fact access m ??

It's obvious that the OP has some sort of misunderstanding, but it's not clear what it is. Do they think that all classes of type B must be referred to with variables of type A? Or do they think interfaces are required to declare every method in every class that implements the interface? Something else?

Your edit improves the question, but are you sure you guessed the OP's intention right?

share|improve this answer
So, I'm not 100% on board with the "not clear" portion, and here's why: we're given a scenario that is apparent - a class implementing an interface also has other methods defined in it, and we're referencing it by the interface and not the concrete type - and the question is, if we're using the interface to reference our concrete type, could we access the implemented method in the concrete type? I believe I guessed the intentions correctly; all I really did was a quick spit-shine, and added code-like illustrations to the question. – Makoto Oct 14 '13 at 3:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .