Assume you write a program that uses the Random class but you fail to include an
ID: 3749639 • Letter: A
Question
Assume you write a program that uses the Random class but you fail to include an import statement for java.util.Random or java.util.*. What will happen when you attempt to compile and run your program?
The program won't run but it will compile with a warning about missing the class.
The program won't compile and you'll receive a syntax error about the missing class.
The program will compile but you'll receive a warning about the missing class.
The program will encounter a run-time error when it attempts to access any member of the Random class.
none of these
The program won't run but it will compile with a warning about missing the class.
The program won't compile and you'll receive a syntax error about the missing class.
The program will compile but you'll receive a warning about the missing class.
The program will encounter a run-time error when it attempts to access any member of the Random class.
none of these
Explanation / Answer
Answer
The program won't compile and you'll receive a syntax error about the missing class.
Explanation
It checks while compiling the program for that method and when it is not found, it throws a syntax error.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.