Java 17 Recipes


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

 The Main Program
The incantation public static void main(...) is used from within a public class to 
denote the entry point of a Java program. That declaration begins an executable method 
named main. You must specify one parameter that is an array of strings, and typically that 
parameter is defined as String[] args. When you execute the currently selected class, 
the JVM transfers control to the main() method, which makes a call to System.out 
.println() to show the Hello World message displayed in the command window.
ChApteR 1 GettInG StARted wIth JAvA 17


8
1-4. Installing Eclipse
 Problem
You want to install a reasonable IDE to use with it.
 Solution
Install the Eclipse IDE to provide a more productive working environment.
First, you need to download the package. Go to 
www.eclipse.org/downloads/
packages/
and click 
Eclipse IDE for Java Developers, as shown in Figure 
1-4
.
Figure 1-4. Downloading Eclipse
ChApteR 1 GettInG StARted wIth JAvA 17


9
The website suggests a mirror site for the download. The installation of Eclipse is 
very easy: expand the downloaded file in the root of your personal computer. When you 
execute Eclipse, it asks you to select a workspace. The workspace is the folder where 
Eclipse stores your development projects. Therefore, it makes sense to place it on a drive 
or in a directory that you back up regularly. Before clicking the OK button, select the 
Use 
this as the default and do not ask again check box. It makes your life easier. You can 
choose the root and use the eclipse-workspace default folder, which is the user’s home 
directory. The first time it executes, Eclipse displays a Welcome screen. To enter the 
screen where you do development, click the Workbench icon, as shown in Figure 
1-5
.
Figure 1-5. Eclipse–the Welcome screen
The IDE is ready. You should see a workspace resembling the one in Figure 
1-6
.
ChApteR 1 GettInG StARted wIth JAvA 17


10
Figure 1-6. Opening the Eclipse IDE
Next, you need to tell Eclipse what version of JDK to use. In Windows OS, go to the 
Windows menu and select Preferences. Select Java and then Installed JREs. You see the 
dialog shown in Figure 
1-7
. Click Edit and select the installed JDK.
Figure 1-7. Eclipse–JDK configuration
ChApteR 1 GettInG StARted wIth JAvA 17


11
You can verify that Eclipse uses the correct JDK. Go to Help ➤ About Eclipse IDE and 
click the Installation Detail button. You can see the path and the name of the installed 
and used JDK, as shown in Figure 
1-8
.

Download 3.2 Mb.

Do'stlaringiz bilan baham:
1   ...   7   8   9   10   11   12   13   14   ...   245




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