Rom Chatterjee<BR>Sun Certified Java Programmer
Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
Originally posted by vishwas bhatt:
Thanx all of you now please see this
Object o = new Object();
String s = new String("Hell");
s = (String)o; //This cast is not Possible Why ?
//====================================
Properties p = System.getProperty();
Enumeration e = p.getNames();
while(e.hasMoreElement())
String s =(String) e.nextElement();//This cast is possible Why ?
System.out.println(s);
//=================================
Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
public interface Enumeration
An object that implements the Enumeration interface generates a series of elements, one at a time. Successive calls to the nextElement method return successive elements of the series.
For example, to print all elements of a vector v:
for (Enumeration e = v.elements() ; e.hasMoreElements() {
System.out.println(e.nextElement());
}
Methods are provided to enumerate through the elements of a vector, the keys of a hashtable, and the values in a hashtable. Enumerations are also used to specify the input streams to a SequenceInputStream.
Younes
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
Yeast devil! Back to the oven that baked you! And take this tiny ad too:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|