wood burning stoves
The moose likes Java in General and the fly likes Any way to accomplish this ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Any way to accomplish this ?" Watch "Any way to accomplish this ?" New topic

Any way to accomplish this ?

Alex Qiu

Joined: Jul 19, 2002
Posts: 24
Such as
Hashtable lvHT = new Hashtable();
Object obj = lvHT;
// Then how to automatically cast the obj back to Hashtable ?
If write code , I can cast it (Hashtable)obj , but how can it "automatically" cast back ?
Is there any way to do this ?

Nothing is impossible to a willing heart .<br />----------------------------------<br />SCJP SCJD
Sabarish Sasidharan
Ranch Hand

Joined: Aug 29, 2002
Posts: 73
Downcasting (casting from super-type to a type lower in the hierarchy) will not be possible automatically. I don't think this automatic conversion is possible.

Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
How would you use such an "automatical cast" at all? Can you give an example where you would like to use it?

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Alex Qiu

Joined: Jul 19, 2002
Posts: 24
Just wondering when writing code ...
It seems no way , so post this topic .
I agree. Here's the link: http://aspose.com/file-tools
subject: Any way to accomplish this ?
It's not a secret anymore!