From the course: Java 8+ Essential Training: Objects and APIs
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Organize code with packages - Java Tutorial
From the course: Java 8+ Essential Training: Objects and APIs
Organize code with packages
- [Narrator] I've previously described how to use custom methods and classes to organize your code. But there's one more critical tool that you'll use to organize it even further, packages. A package is both a description of where a class is in the application and a location on the file system. For example, com.example.java means that there's a subdirectory of the source directory called com, and a subdirectory of that called example, and a subdirectory of that java, and that's the base package for my application. In your application, you should use reverse domain notation. That means you take an organization or personal domain and you switch it so if my web domain is davidgassner.com my package would start with com.davidgassner and then you would add something after that to identify the application. That makes it possible to have class identities that are universal and unique throughout the world of Java. Now within a single application, you can organize your classes with…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
About encapsulation3m 46s
-
Use the Java runtime classes4m 45s
-
(Locked)
Wrap code in static methods5m 56s
-
(Locked)
Declare and use custom classes4m 9s
-
(Locked)
Organize code with packages3m 46s
-
(Locked)
Create and use instance methods2m 27s
-
(Locked)
Manage state with instance variables7m 31s
-
(Locked)
Declare multiple constructor methods5m 2s
-
(Locked)
Use static fields as constants5m 51s
-
(Locked)
Declare and use enum types3m 44s
-
(Locked)
Organize code with nested types4m 15s
-
(Locked)
-
-
-
-
-