Recall & Review
beginner
What is the purpose of an import statement in Java?An import statement allows you to use classes and interfaces from other packages without writing their full package names every time.touch_appClick to reveal answer
beginner
How do you import all classes from a package named <code>java.util</code>?You use <code>import java.util.*;</code> to import all classes from the <code>java.util</code> package.touch_appClick to reveal answer
beginner
True or False: You can import a single class using its full package name.True. For example, <code>import java.util.ArrayList;</code> imports only the <code>ArrayList</code> class.touch_appClick to reveal answer
beginner
What happens if you don't use an import statement but want to use a class from another package?You must use the full package name every time you refer to the class, like
java.util.ArrayList instead of just ArrayList.touch_appClick to reveal answer
beginner
Can you import classes from the same package using an import statement?No, classes in the same package are accessible without import statements.touch_appClick to reveal answer
Which import statement imports all classes from the
java.io package?What is the correct way to import only the
Scanner class from java.util?If you do not import a class, how can you still use it?
Can you import a class from the same package?
What does the import statement
import java.util.*; do?Explain why import statements are useful in Java and how they simplify code.
Describe the difference between importing a single class and using a wildcard import.
