Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+11 votes
asked in CSC211_Winter2018 by (1 point)

2 Answers

+16 votes

I don't know what you mean by java.util.Scanner but there are 2 java imports we use:
1. import java.awt. > to use Graphic
2. import java.util.
> to use Scanner

answered by (1 point)
+15 votes

java.util is a package which contains many classes. One of those classes is Scanner.

If a program imports java.util.*, then the entire java.util package is imported which includes the Scanner class and many others.

If a program imports java.util.Scanner, then just the Scanner class in the java.util package is imported.

The Random class is also a part of the java.util package. If a program imports just java.util.Random, then that program could use the Random class, but not the Scanner class (even though both classes are in the java.util package).

answered by (1 point)
...