|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.deitel.jhtp6.appenH.Time
public class Time
This class maintains the time in 24-hour format.
Object| Constructor Summary | |
|---|---|
Time()
Time no-argument constructor initializes each instance variable to zero. |
|
Time(int h)
Time constructor |
|
Time(int h,
int m)
Time constructor |
|
Time(int h,
int m,
int s)
Time constructor |
|
Time(Time time)
Time constructor |
|
| Method Summary | |
|---|---|
int |
getHour()
Gets the hour. |
int |
getMinute()
Gets the minute. |
int |
getSecond()
Gets the second. |
void |
setHour(int h)
Sets the hour. |
void |
setMinute(int m)
Sets the minute. |
void |
setSecond(int s)
Sets the second. |
void |
setTime(int h,
int m,
int s)
Set a new time value using universal time. |
String |
toStandardString()
Convert to String in standard-time format |
String |
toUniversalString()
Convert to String in universal-time format |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Time()
throws Exception
Exception
public Time(int h)
throws Exception
h - the hour
Exception - In the case of an invalid time
public Time(int h,
int m)
throws Exception
h - the hourm - the minute
Exception - In the case of an invalid time
public Time(int h,
int m,
int s)
throws Exception
h - the hourm - the minutes - the second
Exception - In the case of an invalid time
public Time(Time time)
throws Exception
time - A Time object with which to initialize
Exception - In the case of an invalid time| Method Detail |
|---|
public void setTime(int h,
int m,
int s)
throws Exception
h - the hourm - the minutes - the second
Exception - In the case of an invalid timesetHour(int),
setMinute(int),
setSecond(int)
public void setHour(int h)
throws Exception
h - the hour
Exception - In the case of an invalid time
public void setMinute(int m)
throws Exception
m - the minute
Exception - In the case of an invalid time
public void setSecond(int s)
throws Exception
s - the second.
Exception - In the case of an invalid timepublic int getHour()
integer specifying the hour.public int getMinute()
integer specifying the minute.public int getSecond()
integer specifying the second.public String toUniversalString()
String representation
of the time in universal-time formatpublic String toStandardString()
String representation
of the time in standard-time format
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||