Олимпиадный тренинг

Задача . 37002


Задача

Темы:
public class Time
{
private int hrs;
private int mins;
private int secs;
public Time()
{ /* implementation not shown */ }
public Time(int h, int m, int s)
{ /* implementation not shown */ }
/** Resets time to hrs = h, mins = m, secs = s. */
public void resetTime(int h, int m, int s)
{ /* implementation not shown */ }
/** Advances time by one second. */
public void increment()
{ /* implementation not shown */ }
/** @return true if this time equals t, false otherwise */
public boolean equals(Time t)
{ /* implementation not shown */ }
/** @return true if this time is earlier than t, false otherwise */
public boolean lessThan(Time t)
{ /* implementation not shown */ }
/** @return a String with the time in the form hrs:mins:secs */
public String toString()
{ /* implementation not shown */ }
}

A client class has a display method that writes the time represented by its parameter:
/** Outputs time t in the form hrs:mins:secs.
* @param t the time
*/
public void display (Time t)
{
/* method body */
}

Which of the following are correct replacements for /* method body */?

I  Time T = new Time(h, m, s);
   System.out.println(T);
II System.out.println(t.hrs + ":" + t.mins + ":" + t.secs);
III System.out.println(t);

(A) I only
(B) II only
(C) III only
(D) II and III only
(E) I, II, and III

time 1000 ms
memory 32 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
Комментарий учителя