In: Computer Science
What is a package? What package is the Scanner class in? What package is the String class in?
In java, packages are used for encapsulation. A set of related classes, interfaces or sub packages can be stored inside a package. They appear as folders when we see the project structure. Access of variables and methods can be controlled depening on the package.
Scanner class is present in java.util package. Scanner class is used for doing input/output operations.
String class is present in java.lang package