DefinitionEasy2 marks
What is meant by a package? Give one example.
Topic: Packages
Previous-year question practice database
Answer
Exam answer
A package is a named collection of related classes and interfaces, grouped together so that they can be organised, reused and imported conveniently.
Example: java.util, which contains the Scanner class among others.
Explanation
Give the definition and one example — both are needed. The three packages to know for this paper: java.lang - String, Math, the wrapper classes; imported automatically java.util - Scanner and the collection classes; must be imported java.io - the input and output stream classes Adding that java.lang needs no import statement shows you understand what packages are for.
More from Library Classes
What is the output of the statement Math.pow(36, 6/5);?2026The output of the statement:
System.out.println(Character.toUpperCase('b') + 2); is:2026What is the type of parameter to be given for the method parseInt()?2026Write the Java expression to find the sum of cube root of x and the absolute value of y.2026Character class methods are found in the package called:2025The output of Math.max(-7, Math.min(-5, -4)) is2025