A scrap page is a small file in which one can try out Java expressions. Yes of-course we can do any crap thing on this page… 🙂
To create a scrap page choose File –> New –> Other –> Java –> Java Run/Debug –> Scrapbook Page , give it a name and select a destination folder and we have our own empty scrap page with .jpage extension.
OR alternatively, New –> Other –> type scrap in the <type filter text> wizard and select Scrapbook Page.
Usage:-
Lets start with traditional Hello World example. Open up scrap page and try Hello World thing. To execute, select the statements and right click and Execute (or Ctrl+U).
@Override | |
public String toString() { | |
return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE); | |
} |
Now lets try out arraylist example,
String text = "Hello World!! I am a scrap page!!"; System.out.println(text); java.util.List<Integer> list = new java.util.ArrayList<Integer>(); list.add(1); list.add(2); System.out.println(java.util.Arrays.toString(list.toArray()));
One can also select expression and click on inspect (Ctrl+Shift+I) and display(Ctrl+Shift+D) option of an eclipse.
Try out missing semicolon or any other compilation error, scrap page will stop you…
Scrap page looks pretty promising to do tryouts. However, you need to write fully qualified names instead of importing it.
Have a great weak ahead and enjoy eclipse’s undervalued but extremely powerful feature – The Scrap Page.
Nice one!!
nice one dude..