O'Reilly logo

Getting Started with Eclipse Juno by Vinicius H. S. Durelli, Rafael Medeiros Teixeira, Rodrigo Fraxino Araujo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Generating code

In Java, you will eventually find yourself writing similar pieces of code over and over. Even though the good usage of design principles tends to minimize this, there are some methods, such as getters, setters, and constructors, in most cases look exactly the same. Eclipse can help you by generating code for these simple methods.

You can see all the code that Eclipse can generate by right-clicking anywhere in the Java Editor and choosing the Source entry. This menu can also be opened with the shortcut Alt + Shift + S.

Generating getters and setters

Getters and setters are generally the same. They provide access to some private field of the class by either returning its value or by assigning a new one. To avoid this no-brainer task ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required