Sometimes its useful to be able to run a piece of code to see if it does what you want without having a test case for it.



Eclipse makes this easy to do with its Scrapbook Page feature. To create a Scrapbook Page, New (Ctrl-N) -> Java -> Java Run/Debug -> Scrapbook page. This brings up an editor into which you can add snippets of java code which you can then execute by selecting them, RC->Inspect/Display/Execute



But did you know you could also debug the code you are executing from a scrapbook? Since the scrapbook actually runs the code in a jvm running in a debugger, all you have to do is set breakpoints at the locations you care about. This makes it extremely easy for one to figure out if a utility method is doing what it should (but you should really write a test case ;), or inspect the execution of some javadoc deficient thirdparty code to figure out what it actually does before you make your code depend on it.