Article View: borland.public.jbuilder.java.language
Article #7650Re: About class cast.
From: John McGrath TeamB
Date: Sat, 02 Jun 2001 02:23
Date: Sat, 02 Jun 2001 02:23
20 lines
1426 bytes
1426 bytes
On 31 May 2001 18:52:28 -0700, "wuliao999" no wrote:
> Then, how can I cast Instance_of_myClass to myClass ?
In Java, you cannot cast an instance or an object. An object is of
a given class, and there is nothing you can do to change the class
of the object.
You can cast a reference variable to a different type. This tells
the compiler that the object that the variable refers to will be of
the type that you cast to.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.158210539042d43598a25b@forums.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnewsReferences:
<3b15f7e6$1_2@dnews> <3b16325b_1@dnews> <3b16f55c$1_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-06-01 19:29:50 PST From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.language Subject: Re: About class cast. Date: Fri, 1 Jun 2001 22:23:50 -0400 Message-ID: <MPG.158210539042d43598a25b@forums.borland.com> References: <3b15f7e6$1_2@dnews> <3b16325b_1@dnews> <3b16f55c$1_1@dnews> X-Newsreader: MicroPlanet Gravity v2.30 NNTP-Posting-Host: 209.92.40.60 X-Trace: dnews 991448628 209.92.40.60 (1 Jun 2001 19:23:48 -0700) Lines: 20 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!hub.org!hub.org!PeerFeed.KWeb.on.ca!dnews