help plz.. runtime error
// try compile it, y got runtime error ?
import java.io.*;
class TimeFormatExceptionextends Exception{};
class Time{
privateint hour;
privateint minit;
private BufferedReader in;
private TimeFormatException t;
privateint ansHour;
privateint ansMinit;
private String ans;
public Time(){
in =new BufferedReader(new InputStreamReader(System.in));
hour = 0;
minit = 0;
}
publicvoid setHour(int h){
hour = h;
}
publicint getHour(){
return hour;
}
publicvoid setMinit(int m){
minit = m;
}
publicint getMinit(){
return minit;
}
publicvoid enterTime()throws IOException{
while(ans.equals("y")){
System.out.println("Enter Hour: ");
ansHour = Integer.parseInt(in.readLine());
System.out.println("Enter Minit: ");
ansMinit = Integer.parseInt(in.readLine());
System.out.println("Againt ? ");
ans = in.readLine();
};
}
publicvoid convertTime()throws TimeFormatException{
setHour(ansHour);
setMinit(ansMinit);
if(hour < 12 && minit > 60 ){
t =new TimeFormatException();
throw t;
}
else{
hour-=12;
System.out.println("Time is " +hour+":" +minit);
}
}
}
publicclass ConvertTime{
publicstaticvoid main(String[] args)throws IOException{
Time tt =new Time();
try{
tt.enterTime();
tt.convertTime();
}catch(TimeFormatException t){
System.out.println("There is no such time as " +tt.getHour()+":" +tt.getMinit());
}
}
}

