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

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.

主站蜘蛛池模板: 天祝| 同心县| 景谷| 绥阳县| 依兰县| 柏乡县| 纳雍县| 宁海县| 平凉市| 开江县| 揭阳市| 青岛市| 军事| 柳州市| 响水县| 张北县| 遂宁市| 穆棱市| 黔东| 双流县| 新巴尔虎右旗| 象山县| 阿巴嘎旗| 兴义市| 海口市| 古交市| 博兴县| 楚雄市| 屯留县| 平舆县| 海南省| 鹤峰县| 万山特区| 江城| 都兰县| 彩票| 保亭| 玉树县| 综艺| 晋江市| 泾阳县|