|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.deitel.jhtp4.appenF.Time3
This class maintains the time in 24-hour format.
Object
Constructor Summary | |
Time3()
Time3 constructor initializes each instance variable to zero. |
|
Time3(int h)
Time3 constructor: hour supplied, minute and second defaulted to 0 |
|
Time3(int h,
int m)
Time3 constructor: hour and minute supplied, second defaulted to 0 |
|
Time3(int h,
int m,
int s)
Time3 constructor: hour, minute and second supplied |
|
Time3(Time3 time)
Time3 constructor: another Time3 object supplied |
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. |
java.lang.String |
toString()
Convert to String in standard-time format |
java.lang.String |
toUniversalString()
Convert to String in universal-time format |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Time3() throws java.lang.Exception
Exception
- in the case of an invalid timepublic Time3(int h) throws java.lang.Exception
h
- the hourException
- in the case of an invalid timepublic Time3(int h, int m) throws java.lang.Exception
h
- the hourm
- the minuteException
- in the case of an invalid timepublic Time3(int h, int m, int s) throws java.lang.Exception
h
- the hourm
- the minutes
- the secondException
- in the case of an invalid timepublic Time3(Time3 time) throws java.lang.Exception
time
- Time3 objectException
- in the case of an invalid timeMethod Detail |
public void setTime(int h, int m, int s) throws java.lang.Exception
h
- the hourm
- the minutes
- the secondException
- in the case of an invalid timesetHour(int)
,
setMinute(int)
,
setSecond(int)
public void setHour(int h) throws java.lang.Exception
h
- the hourjava.lang.Exception
- in the case of an invalid timepublic void setMinute(int m) throws java.lang.Exception
m
- the minutejava.lang.Exception
- in the case of an invalid timepublic void setSecond(int s) throws java.lang.Exception
m
- the minutejava.lang.Exception
- in the case of an invalid timepublic int getHour()
int
specifying the hour.public int getMinute()
int
specifying the minute.public int getSecond()
int
specifying the second.public java.lang.String toUniversalString()
String
in universal-time formatString
representation
of the time in universal-time formatpublic java.lang.String toString()
String
in standard-time formattoString
in class java.lang.Object
String
representation
of the time in standard-time format
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |