74.5k views
2 votes
Look at the following statement:

import .Scanner;

Is this a wildcard import?
A) Yes
B) No

1 Answer

4 votes

Final answer:

The statement 'import .Scanner;' is not a wildcard import and is also incorrect syntax in Java. A wildcard import uses an asterisk, as in 'import java.util.*;'. To correctly import the Scanner class, one should use 'import java.util.Scanner;'.

Step-by-step explanation:

The statement import .Scanner; is intended to import the Scanner class in Java. However, this statement is incorrect syntax for importing. In Java, to import a specific class, you would use import java.util.Scanner; without using a wildcard, which implies that you are only importing the Scanner class from the java.util package.

A wildcard import in Java uses an asterisk (*) to import all the classes from a particular package, as in import java.util. Therefore, the statement import .Scanner; is not a wildcard import. Additionally, the statement is syntactically incorrect and should be corrected to properly import the Scanner class in a Java program.

User JohannesD
by
8.0k points