COMP5028_Object Oriented Design_2014 Semester1_tutorial_w5-sample
Practice1
public class MyTime {
long hour; long minute; long second; public MyTime(long h, long m, long s) {
this.hour = h; this.minute = m; this.second = s;
} long getHour() {return this.hour;}
long getMinute() {return this.minute;}
long getSecond() {return this.second;}
}
Practice 2
public class FunctionStepIOLog {
public FunctionStepIOLog() {
StackTraceElement[] stacktrace =
Thread.currentThread().getStackTrace();
StackTraceElement e = stacktrace[1];
String methodName = e.getMethodName();
System.out.println("Method :" + methodName + " has been invoked");
} }


