官术网_书友最值得收藏!

Traditional Java code structure

Traditionally, writing a Java application starts with creating one or more source directories. These are special directories that serve two purposes--firstly, they act as root locations of your Java source code and secondly, the contents of these directories are added to the class path. So, the steps to organize source code have typically been:

  1. Create one or more source folders.
  2. In a source folder, create package folders to mirror the package name.
  3. Place the .java files in the right package folders:

Many Java developers use the directory structure src/main/java for the source directory. So, for example, a class Main.java in the package com.acme.app would have the overall path src/main/java/com/acme/app/Main.java:

 

This is how source code in Java has typically been organized by developers for many years now. With Java 9 modules, there's a change in the way we approach structuring and writing code. Let's switch gears and examine what a module in Java 9 looks like.

主站蜘蛛池模板: 东丰县| 宁武县| 普陀区| 瑞丽市| 西宁市| 会宁县| 邵阳县| 辽阳县| 望都县| 四会市| 北川| 田林县| 宝应县| 高安市| 石棉县| 栾川县| 黔南| 乌拉特后旗| 靖边县| 右玉县| 巴林右旗| 连云港市| 宜章县| 平邑县| 繁峙县| 教育| 勃利县| 东城区| 邵武市| 赤水市| 静安区| 囊谦县| 秭归县| 镇雄县| 民和| 夏邑县| 喀什市| 上林县| 海盐县| 光泽县| 余江县|