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

3.13 Moving Shuffler Implementations Into ScrambledWordLibrary

Juppies 2 by Dr Heinz M. Kabutz

Before moving back to NetBeans, we want to move the Scrambler implementations into the ScrambledWordLibrary class. We do recommend that you get familiar with at least IntelliJ IDEA and NetBeans, perhaps also with Eclipse. These three are the main Java IDEs in use today, and you will most likely be using one of them in your work. Knowing them all will give you an advantage over others who do not. In addition, each IDE has advantages and disadvantages, and it is good to use whatever tool is best for the task at hand.

We move the Scrambler implementations into the ScrambledWordLibrary by selecting the classes and drag & dropping them on top of the ScrambledWordLibrary. IntelliJ does the rest for us.

When looking at the nested classes (or as I call them in the lesson, "inner classes"), we notice that they are static. The reason is that they do not read any of the fields of the ScrambledWordLibrary.

We can also make the nested class to be private instead of public. This means that no one can see them from outside the ScrambledWordLibrary class. It is best to make as many elements of our classes to be private. That allows us to limit how others will depend on our implementation details and that means we can change our inner workings without breaking other programmers' code.

Note: An inner class is a nested class, but a nested class is not necessarily an inner class. An inner class is defined in a non-static context and has a reference to the enclosing object. A nested class is any class that is nested inside another class. An inner class is by definition also nested. However, a static nested class does not an enclosing object and thus is not an inner class.


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.