Since we are dealing with building blocks for the next few tutorials, it is not important to write entire applications with the class and main. This is done with a Java Scrapbook.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7NnQ2bLVcLxPDu-mjn-wXKq_QVOKIkATZrz0cWYRgTjnBe8zWbeZBgDWBdgwL0qt2F-2Mfic8Y9F5f8-6tjV8fFQml-1525LrUhVrBQH6ri4PKZNiKsnKJEQrMZaI5X12OeONrMtKLCan/s1600/java7+-+1.png)
To create a Scrapbook, create a new project, which will contain the Scrapbooks, or just use the last used project. We have to use File New and Other.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYyjAnQ4uSL0ATYHLsjIiE3OVngx7yXk9z08NG8mQKDgpiJAYT181u6s4osufgtT_WmwrJigLsMQQ6nyJBlq3b_tfuu6IO0FOH2-NK2bIjnSDTPOtNdebcjwDl3IYEMnIPff5LTs_VBIWD/s1600/java7+-+2.png)
Next, we have to double click Java so it will show more options under that folder.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLieWUa0_ajUCwDb7rgvNdEtUmgD7lea1AtZ4QY70FjretqsczDJEZUcpsGy0fKxTE17qaW9IGVzWmP0nqZhgdI911EwZ-sv8kbFwG3WjTuSqQ3N4b33C75N_zqJC6rASaCUqQ8jYT-H-1/s1600/java7+-+3.png)
In the Java Run/Debug subfolder, select Scrapbook Page. In the next, we set the name, such as ex7.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjuRrfU_zawZbYtwQ2clHmohqgOv756UvjPx4Z28L0Yl6me457VWxesfoQl7ka87W7cpyyBrLwHLJWukYWSSK2u1y42zf8XUVsWOnbdX20AK8gOyAAEFHvjkbTqFCWyaGX1Q_4CDqIWR5M/s1600/java7+-+4.png)
A simple java program is written. Next all text is selected, and the Execute the Selected Text toolbar is clicked. This toolbar should be near the top-right portion of screen.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhskDpZN63MhgO_leNTU9CP0DV_zPew-xoYYn6mV594kMpuZlpGjV5wWisudOS7DM_oF18werpnLKx3BV7IsqrRmS8YIBweVBrQDE_9wVYlP8SdmUP5XQgykV8BFLlllrTUYWJchr9thxjL/s1600/java7+-+5.png)
// ex7.jpage int a = 1; int b = 3; System.out.println("Sum = " + (a+b)); System.out.println("Difference = " + (a-b));
No comments:
Post a Comment