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

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.

主站蜘蛛池模板: 临泉县| 巴塘县| 锡林郭勒盟| 芷江| 长顺县| 鄯善县| 南涧| 左贡县| 印江| 丹寨县| 关岭| 陆良县| 确山县| 德惠市| 虹口区| 克山县| 舟山市| 林周县| 深水埗区| 汝城县| 华容县| 大庆市| 和田市| 阳曲县| 镇原县| 德钦县| 会理县| 进贤县| 菏泽市| 尉氏县| 大厂| 比如县| 南开区| 灵台县| 盐池县| 偏关县| 抚远县| 台州市| 霍山县| 拜泉县| 余江县|