perché devi scrivere
codice:
passText.setEchoChar('\0');
e non
codice:
passText.setEchoChar('0');
è come se lo settassi a carattere null, non a zero.
Devi considerare anche il tipo di dato che tu hai :
codice:
Character c = '0';
System.out.println("valore " + c.hashCode());
c = '\0';
System.out.println("valore " + c.hashCode());
c = 0;
System.out.println("valore " + c.hashCode());
noti che hai un risultato differente a seconda dei casi (e te lo dice l'hashcode)
per il carattere '0' hai 48 , null '\0' o con promozione di cast hai hashcode 0 ed è quello che vuole la echochar
guarda anche
qui