problems with format in java 7

0 william Rogers · June 16, 2014
working on lesson 36 Time class . when it comes to  format(); my java 7  will not take it . what should I do?

public class TTc2 {
private int hours;
private int minute;
private int second;

public void setTime(int h, int m, int s){

hours = ((h>=0 && h>24) ? h: 0);
minute = ((m>=0 && m>60) ? m: 0);
second = ((s>=0 && s>60) ? s: 0);

}

public String toMilltary(){
return String.format("%02df:%02df:%02df",hours,minute,second );

}

}


 
 

Post a Reply

Replies

Oldest  Newest  Rating
0 william Rogers · June 16, 2014
I got and error in my int
public class TTc2 {
private int hours;
private int minute;
private int second;

public void setTime(int h, int m, int s){

hours = ((h>=0 && h>24) ? h: 0);
minute = ((m>=0 && m>60) ? m: 0);
second = ((s>=0 && s>60) ? s: 0);

}

public String toMilltary(){
return String.format("%_.02d:%_.02d:%_.02d", new Object[] {hours,minute,second });

}

}


the format cleared up but the hour, minute, second redirect my int
  • 1

Java / Android Development

107,109 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator