Today I wrote a simple program in eclipse Kepler in java 8. Actually, I copied it from some video tutorial. In that tutorial, it ran, but in my computer it didn't. Error line is
 String.format("%02d:%02d:%02d",hour,minute,second);
I don't understand what the error is here.
It highlights the method format(String,object[]) in the type String are not applicable for the argument(String, int, int, int)
public class Demo {
private int hour;
    private int second;
    private int minute;
    public void setTime(int h,int m,int s){
        hour=((h>=0 && h<24)?h:0);
        minute=((m>=0 && m<60)?m:0);
        second=((s>=0 && s<60)?s:0);
    }
    public String railwayTime(){
        return String.format("%02d:%02d:%02d",hour,minute,second);//error in this line
    }
    public String regular(){
        return String.format("%02d:%02d:%02d %s",((hour==0 ||hour==24)?12:(hour%12)), minute, second, (hour>=12)?"AM":"PM");//error in this line
    }
}
public class ShowTime {
    public static void main(String[] args){
        Demo d=new Demo();
        System.out.println(d.railwayTime());
        System.out.println(d.regular());
    }
}
 
     
     
     
    