The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

program u asked for

Posted by saddy on December 27, 2000 at 12:49 PM

> Hi Saddy
> Please send me the program you are talking about. There are things in Java which is not permitted if we , the programmer , do it but in internally they are. For example the two modifiers "abstract" and "final" cannot be used with a class. But when you declare an array of int ( in fact for any array ) like
> int[] arr = new int[50] ;
> now when you try to find the class of arr in it is
> public abstract final [I ...

> So, you may be right if the program you are referring to has been written by the creator of Java themselves...

> Thanx
> Kishori

Hi Kishori,
here is the program that i was talking about


class vectors{
public static void main(String args[])
{
Vector a = new Vector();

a.addElement(new String("Hello"));
a.addElement(new String(" to"));
a.addElement(new String(" this"));
a.addElement(new String(" World"));

Enumeration vEnum = a.elements();
while(vEnum.hasMoreElements())
{
System.out.print(vEnum.nextElement());
}
}
}

Here hasMoreElements() and nextElement() both of Enumeration interface are used without overriding them, how is it working?
i will be thankful if u could clear my doubt

saddy




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us