Ho provato come hai detto ma non va.
In particolar modo inizialmente funge poi quando ritorna nella seconda lettura esce tutto attaccato:codice:public void addComponenti() throws IOException { while (true) { System.out.print("Inserisci nome: "); nome = tastiera.readLine(); if(nome == "*") { break; } else { System.out.print("Inserisci città: "); citta = tastiera.readLine(); if(citta == "*") { break; } else { System.out.print("Inserisci numero: "); num = tastiera.read(); String k = String.valueOf(num); if(k == "*") { break; } } } } }
(così come da console ti allego):
Inserisci nome: Inserisci città:
Il ché è abbastanza strano.