[scienze.unimo] Re: Assurdo...

  • From: "Roberto Cavicchioli" <trebor86it@xxxxxxxx>
  • To: <scienze.unimo@xxxxxxxxxxxxx>
  • Date: Wed, 13 Dec 2006 08:54:58 +0100

Tasker wrote
public class lol {

   public static void main(String args[]) {

   String vc=new String("");
   int c=1;
   if (vc!="" && c!=0)
   System.out.println("Ciao");
   }
}

Semplicemente il problema è che bisogna usare il metodo 'vc.equals("")' invece che il molto C like '!=' Il controllo di uguaglianza viene fatto sul puntatore all'oggetto stringa vc e il carattere nullo \0... Mi sembra normale che siano diversi!!! :-)

Byez Chiacchiera con i tuoi amici in tempo reale! http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com

Other related posts: