KnowledgeBoat Logo

Computer Applications

What is a package? Give an example.

Values & Data Types Java

218 Likes

Answer

In Java, a package is used to group related classes. Packages are of 2 types:

  1. Built-In packages — These are provided by Java API
  2. User-Defined packages — These are created by the programmers to efficiently structure their code.

java.util, java.lang are a couple of examples of built-in packages.

Answered By

141 Likes