Java 17 Recipes


Download 3.2 Mb.
Pdf ko'rish
bet14/245
Sana02.06.2024
Hajmi3.2 Mb.
#1839910
1   ...   10   11   12   13   14   15   16   17   ...   245
Bog'liq
Java 17 Recipes

Figure 1-12. Naming the package in Eclipse IDE
ChApteR 1 GettInG StARted wIth JAvA 17


16
Figure 1-13. Creating and naming a new class in Eclipse IDE
ChApteR 1 GettInG StARted wIth JAvA 17


17
Tip You can create package and class in the same configuration window by 
simply creating a new class and typing package and class name in the name field. 
Moreover, by convention, class names usually start with an uppercase letter.
Make sure that you enter the project name, the package name, and the class
name exactly as we provide them here because the code to follow depends on your
doing so. Make sure the project name is java17Recipes. Make sure the package is
org.java17recipes.chapter01.recipe01_05. Make sure the class is HelloWorld.
Next, you should look at a Java source file. Skeleton code is generated for you, and 
your Eclipse IDE window should resemble the one shown in Figure 
1-14
.
Figure 1-14. Viewing the skeleton code generated by Eclipse
Place your cursor anywhere in the source code pane. Press Ctrl+A to select all the 
skeleton code. Then press Delete to get rid of it. Replace the deleted code with that from 
Listing 
1-2
. Then, create another class, name it HelloMessage, and copy the code from 
Listing 
1-3
.
You can find the code in Listing 
1-2
 and Listing 
1-3
as part of our example download 
for the book. There are two files named HelloMessage.java and HelloWorld.java, which 
reside in a Java package named org.java17recipes.chapter01.recipe01_05. Note that 
all recipe solutions of substance throughout this book are in that example download.
The class is named HelloWorld, and it initiates the program.

Download 3.2 Mb.

Do'stlaringiz bilan baham:
1   ...   10   11   12   13   14   15   16   17   ...   245




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling