ho fatto cosi:
codice:
public static Città raed(Scanner s)
{
DateFormat df= new SimpleDateFormat("dd/MM/yyyy");
String Sd,n ,Smn,Smx;
int mx ,mn;
Date d = null;
if(contatore==0)
{
if(!s.hasNextLine())
return null;
Sd=s.nextLine();
try {
d = df.parse(Sd);
} catch (ParseException e) {
e.printStackTrace();
}
}
if(!s.hasNextLine())
return null;
n=s.nextLine();
if(!s.hasNextLine())
return null;
Smn=s.nextLine();
mn=Integer.parseInt(Smn);
if(!s.hasNextLine())
return null;
Smx=s.nextLine();
mx=Integer.parseInt(Smx);
contatore++;
if(contatore==5)contatore=0;
return new Città(d,n,mn,mx);
}
solo adesso mi da questo output
01/01/2013
Avellino
5
14
null
Benevento
3
13
null
Caserta
4
15
null
Napoli
7
16
null
Salerno
1
15
02/01/2013
Avellino
5
13
null
Benevento
4
11
null
Caserta
4
16
null
Napoli
7
9
cioè mi schiaffa quei null nella posizione della data...come dovrei farli sparire?