Article View: borland.public.jbuilder.java.language
Article #7641Re: About class cast.
From: wuliao999 no
Date: Fri, 01 Jun 2001 01:52
Date: Fri, 01 Jun 2001 01:52
23 lines
1406 bytes
1406 bytes
for example: String className="com.borland.myClass"; ArrayList myClass_List; Object Instance_Of_myClass=myClass_list.get(i); Then, how can I cast Instance_of_myClass to myClass ? > >I am not sure what you mean by "cast an objects' type to this". >Can you provide pseudo-code to show what you are after? > >You can get a Class instance with >Class c = Class.forName(className); > >Torsten > >"wuliao999" no wrote: >>I get a class name from a string, for example: >>String className="com.borland.myClass"; >>how can I cast an objects' type to this? >
Technical Details
Message-ID:
<3b16f55c$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!howland.erols.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b15f7e6$1_2@dnews> <3b16325b_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,25286dd36905df6c X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-31 19:13:12 PST From: "wuliao999" no Sender: "wuliao999" no Reply-To: "wuliao999" no Subject: Re: About class cast. Newsgroups: borland.public.jbuilder.java.language X-User-Info: 210.52.222.121 210.52.222.121 References: <3b15f7e6$1_2@dnews> <3b16325b_1@dnews> NNTP-Posting-Host: 207.105.83.65 Message-ID: <3b16f55c$1_1@dnews> Date: 31 May 2001 18:52:28 -0700 X-Trace: dnews 991360348 207.105.83.65 (31 May 2001 18:52:28 -0700) Lines: 24 Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!howland.erols.net!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews