import ZeitCheckException; class ZeitCheck { private boolean wrong = false; private ZeitCheck zeit; public ZeitCheck(int hour, int min, int sec) throws ZeitCheckException { if ( (hour < 0) | (hour > 23) ) wrong = true; if ( (min < 0) | (min > 59) ) wrong = true; if ( (sec < 0) | (sec > 59) ) wrong = true; if (wrong) throw new ZeitCheckException("Fehleingabe!"); } public void setTime(int hour, int min, int sec) throws ZeitCheckException { zeit = new ZeitCheck(hour, min, sec); } }