ricorsione

This commit is contained in:
Orange_dugongo 2016-11-28 20:14:54 +01:00
parent 2c06ca0601
commit 117eef00bc

View File

@ -21,19 +21,15 @@ public class Azienda{
private Dipendente read(Scanner sc) throws Exception{ private Dipendente read(Scanner sc) throws Exception{
String id; String id;
try{ if(!sc.hasNext()) return null;
if(!sc.hasNext()) return null; id=sc.next();
id=sc.next(); if(id.equals("OP"))
if(id.equals("OP")) return Operaio.read(sc);
return Operaio.read(sc); else if(id.equals("DIR"))
else if(id.equals("DIR")) return Dirigente.read(sc);
return Dirigente.read(sc); else{
else sc.nextLine();
throw new IOException("Classe non presente"); return read(sc);
}
catch(IOException Exception){
System.err.println("***"+Exception.getMessage()+"***");
return null;
} }
} }