Problem1189--Java SimpleTime演示

1189: Java SimpleTime演示

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 2  Solved: 1
[Submit] [Status] [Web Board] [Creator:]

Description

代码如下:

import javax.swing.*;
import java.text.DecimalFormat;
 
public class Java_1 {
    //*********Found********** 
    public static ___________________ main(String args[]) {
        SimpleTime t = new SimpleTime(12, 30, 19);
        //*********Found********** 
        ___________________.showMessageDialog(null, t.buildString(),
                " \"this\" 引用示范",
                JOptionPane.INFORMATION_MESSAGE);
        System.exit(0);
    }
}
 
class SimpleTime {
 
    private int hour, minute, second;
 
    public SimpleTime(int hour, int minute, int second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }
 
    public String buildString() {
        //*********Found********** 
        return "this.toString(): " + ___________________()
                + "\ntoString(): " + toString()
                + "\nthis (with implicit toString() call): "
                + this;
    }
 
    public String toString() {
        DecimalFormat twoDigits = new DecimalFormat("00");
        return twoDigits.format(this.hour) + ":"
                + twoDigits.format(this.minute) + ":"
                + twoDigits.format(this.second);
    }
}

Source/Category