- Java 9 Programming By Example
- Peter Verhas
- 263字
- 2021-07-02 23:37:32
Setting up the project with Maven
To start the project, we will use the directory structure and pom.xml that was created by Maven itself when we started with the following command line:
$ mvn archetype:generate
It created the directories, the pom.xml file, and an App.java file. Now, we will extend this project by creating new files. We will code the sorting algorithm first in the packt.java9.by.example.stringsort package:

When we create the new package in the IDE, the editor will automatically create the stringsort subdirectory under the already existing src/main/java/packt/java9/by/example directory:

Creating the new Sort class using the IDE will also automatically create a new file named Sort.java in this directory, and it will fill in the skeleton of the class:
package packt.java9.by.example.stringsort;
public class Sort {
}
We will now have App.java containing the following code:
package packt.java9.by.example;
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
Maven created it as a starting version. We will edit this file to provide a sample list that the sorting algorithm can sort. I recommend that you use the IDE to edit the file and also to compile and run the code. The IDE provides a shortcut menu to start the code and this is a bit easier than typing the command in Terminal. Generally, it is recommended that you get acquainted with the IDE features to save time avoiding repetitive tasks, such as typing terminal commands. Professional developers use the command line almost exclusively to test command-line features and use the IDE whenever it is possible.

- Power Up Your PowToon Studio Project
- 算法訓(xùn)練營:入門篇(全彩版)
- 算法大爆炸:面試通關(guān)步步為營
- Java加密與解密的藝術(shù)
- C語言程序設(shè)計案例精粹
- Learning Python Design Patterns
- 小學(xué)生C++創(chuàng)意編程(視頻教學(xué)版)
- D3.js By Example
- JavaScript腳本特效編程給力起飛
- Django實(shí)戰(zhàn):Python Web典型模塊與項(xiàng)目開發(fā)
- 深入淺出 HTTPS:從原理到實(shí)戰(zhàn)
- Java 11 and 12:New Features
- RESTful Web API Design with Node.js
- 透視C#核心技術(shù):系統(tǒng)架構(gòu)及移動端開發(fā)
- Python程序設(shè)計教程