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

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.

主站蜘蛛池模板: 宝清县| 桂东县| 彰武县| 宁津县| 大埔区| 龙口市| 武鸣县| 胶州市| 加查县| 宝兴县| 象州县| 密山市| 远安县| 简阳市| 故城县| 洪雅县| 南康市| 四会市| 融水| 万州区| 松阳县| 秦安县| 绥中县| 华宁县| 平度市| 红原县| 尼木县| 三门峡市| 浪卡子县| 安康市| 阿勒泰市| 六盘水市| 钟祥市| 廊坊市| 桂平市| 芮城县| 万安县| 夏邑县| 台前县| 绥宁县| 巴林左旗|