Path: csiph.com!aioe.org!.POSTED.hqPgifCF1TaqUfx+6Uvsxg.user.gioia.aioe.org!not-for-mail From: Gioacchino Newsgroups: it.comp.java Subject: =?UTF-8?Q?Re=3a_perch=c3=a8_non_funziona_questo_cast=3f?= Date: Sat, 7 Sep 2019 21:03:31 +0200 Organization: Aioe.org NNTP Server Lines: 27 Message-ID: References: NNTP-Posting-Host: hqPgifCF1TaqUfx+6Uvsxg.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-Notice: Filtered by postfilter v. 0.9.2 Content-Language: it Xref: csiph.com it.comp.java:9328 Il 07/09/2019 09:14, Dr.UgoGagliardelli ha scritto: > 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. quindi Object e Number si possono assegnare a Object , ma Object non si puņ assegnare a Number , giusto? grazie