Java ClassesLesson 33Free preview
Java Packages / API
This lesson is part of Java · All levels
Summary
Package is a related class grouping container, such as java.util for data structures and utilities. With the package, the class names are not easily collision and access is more organized. You use the package statement to declare ownership and you use the importation to use the class from another package.
Key points
- The package declaration is written at the top of the file: package namanya.package;
- Import is used to use a class from another package, e.g. import java.util.Scanner;
- Packages like java.lang do not need to be imported because they are always available
- Java APIs are a collection of official packages and libraries ready for use by programmers
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.