Display Execution Steps - Java Program
Hello,
I'm wondering if any of you know how to display the execution steps when you run a java program. I'm taking a class and have completed the work but the instructor has asked us to submit it in such as way that when the program is run it will show which method is executing as it happens. Were are supposed to submit the jar file.
Eg: when the program is run it should show the following:
main()
constructor()
method1()
method2()
etc...
We are using eclipse so not sure if it's a function built into the IDE or something else that has to be done. Appreciate any advice.
Max
Re: Display Execution Steps - Java Program
System.out.println("functionName()");
Re: Display Execution Steps - Java Program
Quote:
Originally Posted by
KevinWorkman
System.out.println("functionName()");
Thanks Kevin! Could you elaborate a little I'm not clear on how that would solve the problem...
Re: Display Execution Steps - Java Program
I think you're looking for a more complicated solution than is required. At the top of every method, simply print out the name of that method.
Re: Display Execution Steps - Java Program
Thanks but that won't work. It needs to be automated. So that it prints the method names and constructor names as the program runs. Adding print statements does not solve the problem.
Re: Display Execution Steps - Java Program
Quote:
Originally Posted by
Max Avion
Thanks but that won't work. It needs to be automated. So that it prints the method names and constructor names as the program runs. Adding print statements does not solve the problem.
Haha okay, if you're sure. I really think you're overthinking this though. I suppose you could look into printing the stack trace though- there's a nice google term for you.
Re: Display Execution Steps - Java Program
:) Ok thanks I will give that a shot. Maybe I am over thinking it but just wasn't sure which way to approach this. Thanks again for your help!
Re: Display Execution Steps - Java Program
Quote:
Originally Posted by
Max Avion
Thanks but that won't work. It needs to be automated. So that it prints the method names and constructor names as the program runs. Adding print statements does not solve the problem.
:o
Good luck though :cool: