Article View: borland.public.jbuilder.java.language
Article #622Re: cast (from java.util.Date to java.sql.Date)
From: Gillmer J. Derge [TeamB]
Date: Thu, 31 Mar 2005 14:24
Date: Thu, 31 Mar 2005 14:24
16 lines
1627 bytes
1627 bytes
Petar Popara wrote: > Re: cast (from java.util.Date to java.sql.Date) > Why do I get "java.lang.ClassCastException: java.util.Date"? Because you're going the wrong direction. java.sql.Date is a more specific type of Date. What you're doing is like casting a Fruit to an Apple. Maybe it works, because maybe that Fruit really is an Apple, but maybe it's an Orange or a Banana. You can always cast an Apple to a Fruit (and thus a java.util .Date to a java.sql.Date) but you can't always go the other direction. public class java.sql.Date extends java.util.Date -- Gillmer J. Derge [TeamB]
Technical Details
Message-ID:
<424c0811$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<424c052d$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,da28624d2281bc9c X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 31 Mar 2005 09:24:18 -0500 From: "Gillmer J. Derge [TeamB]" <spam@gillmerderge.com> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: cast (from java.util.Date to java.sql.Date) References: <424c052d$1@newsgroups.borland.com> In-Reply-To: <424c052d$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.149.56.207 Message-ID: <424c0811$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1112279057 24.149.56.207 (31 Mar 2005 06:24:17 -0800) Lines: 16 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail