‹ Back to the paper
State the purpose of the following keywords in Java: package import
State the purpose of the following keywords in Java:
(a)[1.0]
package
(b)[1.0]
import
Answer
Answer (a)
AIpackage: it groups related classes and interfaces together under one namespace, making them easier to organise, locate, reuse and avoid naming conflicts.
Answer (b)
AIimport: it is used to bring a class (or all classes) of a package into a program so that its members can be used without writing the fully qualified name each time.
From ISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024), question 50.