Java Reference
In-Depth Information
Figure 4.1.
As you can see in Figure 4.1 , we get an alert box saying "Hello World!".
The function can be invoked over and over again just by typing its name followed by par-
entheses. This is one of the advantages of using functions―there's no need to write repetit-
ive blocks of code. Another advantage is that all the functionality is kept in one place. So if
you want to change part of it, you only need to update the code in one place. This is known
as the DRY principle, which stands for Don't Repeat Yourself , and it's important to keep
in mind when programming.
Search WWH ::




Custom Search