karleebernese1817 karleebernese1817
  • 24-02-2018
  • Computers and Technology
contestada

What is the output from system.out.println((int)(math.random() * 4))?

Respuesta :

pbzepplin
pbzepplin pbzepplin
  • 09-03-2018
In java, the math.random() function call will return a random number between 0 and 1. Therefore, the call 'math.random() * 4' will return a number between 0 and 4. The casting of this call to an integer '(int)' will return an integer with no fraction, so numbers 0, 1, 2, 3 or 4.
Answer Link

Otras preguntas

The original price of AirPods are $159 at the Apple store. They are having a sale online for 15% off. How much do you pay for the AirPods?
How can the carbon stored in plants reach the atmosphere? Evaporation Diffusion Photosynthesis Cellular Respiration
Graph the solution of the inequality. v−4≥−9
What are the sources of the majority of fats and oils in the typical human diet?
A production process produces 1.5% defective parts. A sample of six parts from the production process is selected. What is the probability that the sample conta
Which element and animal best represents your personality and why?
Best Buy is displaying 15 laptops for a big store sale. The laptops include 6 identical​ Dells, 4 identical​ Chromebooks, and 5 identical Macbooks. They must al
What was life like during the Industrial Revolution?
Which of the following is the correct factorization of the polynomial below? x³-15 A.) (x+3)(x-5) B.) (x-3)(x+5) C.) (x+3)(x²-4x+5) D.) The
5.6.4 Uassily two-dimensionalcategories based on their properties.ral.718°42 in.​