[5130] in java-interest

home help back first fref pref prev next nref lref last post

Re: interfaces as return types????????

daemon@ATHENA.MIT.EDU (Walter Szewelanczyk)
Mon Jan 29 21:43:18 1996

From: "Walter Szewelanczyk" <Walter@stumpy.adco.com>
To: java-interest@java.sun.com
Date: Mon, 29 Jan 1996 20:37:40 +0000

Hi all,

It appears that you can treat an Interface similar to how you would 
an abstract base class.  Although you can't Instantiate an interface 
you can declare a variable of type <Interface> and assign it any 
object that impements its Interface just as you can assign a derived 
subclass to its abstract ancestor.

for instance:  Enumeration is an interface and StringTokenizer 
implements the Enumeration Interface :

{
  Enumeration E = new StringTokenizer("Hi There");
  System.out.println((String)E.nextElement());
}
would print out "Hi"

Walt

********************************************************************************************
Walter Szewelanczyk					Technical Director 
Walter@adco.com						NET VENTURE, Inc.


	"One must stay in a very RIGID state of FLEXABILITY"

********************************************************************************************
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post