Summary
In this chapter, we saw how packages allow you to better organize your code, which becomes essential when working on large projects. When you use classes from another package, you need to import these classes into your code.
When you create your own packages, place your code into packages based on the purpose of the code and name these packages based on your organization's internet domain name. For example, you might create packages called com.packtpub.medical.report
and com.packtpub.medical.heartrate
.
You will often incorporate your Java code into a JAR file. A JAR file is like a compiled library of Java code. Executable JAR files contain the name of a Java class with a main()
method that you can run with the java-jar
command.
Java build tools such as Maven or Gradle help a lot when working on large projects. These two build tools also support downloading and using third-party open source Java libraries—libraries that are used in just about every large...