Question: What is the output of the following code? import java.lang.Math. *; class Main { public static void main(String args[]) { float rand = Math.random();
What is the output of the following code? import java.lang.Math. *; class Main { public static void main(String args[]) { float rand = Math.random(); System.out.println(5 - rand % 10); } } a. greater than 0, less than 5 b. Error c. greater than 0, less than equal to 5 d. greater than 0, less than equal to 4
Step by Step Solution
★★★★★
3.32 Rating (152 Votes )
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Answer B Error The random function turns a double value with a positive sig... View full answer
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
