Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class ThisTest here.
- *
- * @author Ahmad Lamaul Farid
- * @version 08 Oktober 2020
- */
- 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 hour;
- private int minute;
- private int second;
- public SimpleTime( int hour, int minute, int second )
- {
- this.hour = hour;
- 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.hour, this.minute, this.second );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement