Java 17 Recipes


-5. Getting to “Hello, World”


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

1-5. Getting to “Hello, World”
 Problem
You’ve installed Java SE 17 and the Eclipse IDE. Now you want to run a simple Java 
program to verify that your installation is working properly.
 Solution
Begin by opening the Eclipse IDE. You may see some projects in the left pane if you’ve 
already been working on projects within the IDE.
ChApteR 1 GettInG StARted wIth JAvA 17


13
Go to the File menu and select New ➤ Java Project, as shown in Figure 
1-9
.
Figure 1-9. Selecting Java project
The dialog is shown in Figure 
1-10
.
ChApteR 1 GettInG StARted wIth JAvA 17


14
Figure 1-10. Creating a new Java project
Name your project 
java17Recipes. Enter the project name in the text box at the top 
of the dialog, as shown in Figure 
1-10
.
In the JRE section, select the installed JDK (i.e., the JavaSE-17 that you just 
configured). Press Finish to complete the wizard and create a skeleton project.
Tip Java is case-sensitive. Moreover, by convention, project names should start 
with a lowercase letter.
Now, create a new package. Go to the File menu and select New ➤ Package, as 
shown in Figure 
1-11
.
ChApteR 1 GettInG StARted wIth JAvA 17


15
Figure 1-11. Creating a new package in Eclipse IDE
Name the package org.java17recipes.chapter01.recipe01_05 as shown in Figure 
1-12
.
Tip By convention, package names usually start with a lowercase letter.
Next, create a new class. Go to the File menu, select New ➤ Class, and name the class 
HelloWorld, as shown in Figure 
1-13
.

Download 3.2 Mb.

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




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