Running on Java 19-ea+23-1706 (Preview)
Home of The JavaSpecialists' Newsletter

1.11 Adding Our Own Words to the StaticWordLibrary

Juppies 2 by Dr Heinz M. Kabutz

We add three words to the StaticWordLibrary, first correct and then jumbled. We notice that the alignment of the text seems incorrect. In Java, the alignment is not significant. We can write:

  "beer", "chocolate", "coffee",





And these all mean exactly the same.

We can automatically format our code to make it look more consistent. The easiest is to type Alt+Shift+F and then the alignment will look nicer. Since white space is not significant, it is useful as a programmer to be able to read lots of different programming styles without getting confused. That way, when you move between teams and companies, you won't get stumped when you see the same code written in a slightly different way.

NetBeans marks the lines that we have changed in the margin. This makes it easy to quickly spot what has changed in a file since we last checked in our changes.

When we wrote the scrambled version of chocolate, we made a mistake in the scrambled word and only noticed that when we ran the program. It would have been better if we could find such mistakes automatically, rather than having to try answer them all - that is tedious.


When you load these comments, you'll be connected to Disqus. Privacy Statement.

Table of Contents

We hope you enjoyed this tutorial. If you did, you will also enjoy our courses. We suggest you start with Extreme Java - Advanced Java, followed by Extreme Java - Concurrency Performance for Java 8.

About the Author

Heinz Kabutz Java Conference Speaker

Java Champion, author of the Javaspecialists Newsletter, conference speaking regular... About Heinz

Superpack '22

Superpack '22 Our entire Java Specialists Training in one huge bundle more...

Free Java Book

Dynamic Proxies in Java Book
Java Training

We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations.

Java Consulting

We can help make your Java application run faster and trouble-shoot concurrency and performance bugs...

Java Emergency?

If your system is down, we will review it for 15 minutes and give you our findings for just 1 € without any obligation.