In eclipse you can write few lines of codes without having to write the entire class declaration and main method to execute the few lines. This feature is called scrapbook if you have a java enabled project create a new file with the extension as ".jpage".
The next step would be is to write a few lines of code in that page...
- String message="Hello %1$s";
- message = message.format(message,"Jane Doe");
The step after that would be is to select the lines of code you want to execute and access the right click menu
Select the execute option and the just the selected lines of code alone would be executed and outputted in the console. I use this feature to quickly test a few lines of code…