Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class thistest here.
- *
- * @author (Muhammad Bagus Istighfar)
- * @version (14.10.20)
- */
- public class thistest
- {
- public static void main (String[] args)
- {
- SimpleTime time = new SimpleTime(15,30,19);
- System.out.println(time.buildString());
- }
- }
- class SimpleTime
- {
- private int hours;
- private int minute;
- private int second;
- public SimpleTime( int hours, int minute, int second)
- {
- this.hours = hours;
- this.minute=minute;
- this.second= second;
- }
- public String buildString()
- {
- return String.format ("%24s: %s\n%24s: %s",
- "this.toUniversalString()", this.toUniversalString(),"toUniversalString()",
- toUniversalString());
- }
- public String toUniversalString()
- {
- return String.format("%02d:%02d:%02d",this.hours,
- this.minute, this.second);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment