PRASHNIKAप्रश्निका
‹ Back to the paper

State the purpose of the following keywords in Java: package import

Computer Science20252 marksShort answer
State the purpose of the following keywords in Java:
(a)[1.0]
package
(b)[1.0]
import

Answer

Answer (a)

AI
package: it groups related classes and interfaces together under one namespace, making them easier to organise, locate, reuse and avoid naming conflicts.

Answer (b)

AI
import: 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.
Programming in Java (Review of Class XI Sections B and C)

From ISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024), question 50.