Re: Polymorphism in Java SE?
Patricia Shanahan <pats@acm.org> writes:
A near miss is the field ?System.in?, which indeed contains an
object of a proper /subtype/ of the field's type. So it is
somewhat polymorphic. You do not know the actual type until
run-time. It is only boring insofar as it is always the same
subtype.
Huh? Why do you say it is always the same subtype?
Said ?always the same subtype?,
thought ?always the same subtype at the start of a program?.
Sorry, I should also have written ?at the start of a program?.
System.setIn(someStream);
Yes, indeed. This is possible. Thank you.
Here one party (your code) sets the field and then /the same
party/ reads it in again. I believe it might be more
suggestive when polymorphism is used for communication between
/two/ parties. Therefore, I searched for a Java-SE factory
method, so that I can show, how Java SE conveys information to
an application by a polymorphic expression.
(I have not yet acknowledged Marks post in my previous post,
because I had not read it then. So I'd also like to thank him
for the Swing example.)