Path: csiph.com!aioe.org!.POSTED.7ScDZFY9tkoFmyIJl7ipHw.user.gioia.aioe.org!not-for-mail From: "Dr.UgoGagliardelli" Newsgroups: it.comp.java Subject: =?UTF-8?Q?Re=3a_perch=c3=a8_non_funziona_questo_cast=3f?= Date: Sat, 7 Sep 2019 09:14:52 +0200 Organization: Aioe.org NNTP Server Lines: 20 Message-ID: References: NNTP-Posting-Host: 7ScDZFY9tkoFmyIJl7ipHw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 X-Antivirus-Status: Clean X-Antivirus: Avast (VPS 190906-0, 06/09/2019), Outbound message Content-Language: it-IT X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com it.comp.java:9326 Il 06.09.2019 21.04, Gioacchino ha scritto: > Metodo (List   numbers) ... > > > poi in un ciclo: > > for ( Number n : numbers ) > > etc > > e mi da errore, mi dice type mismatch e che non puņ castare (? super > number) to number , e mi propone > > for ( Object n : numbers ) > > > Certamente object č una superclasse, ma non posso usare la stessa classe > Number? Ebbene no. Hai una lista che ammette le superclassi di Number, quindi solo Object.