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 value of the square root of 42
which of the following is an experimental study?
individuals are exposed to many agents of socialization throughout their lifetime. Discuss this statement with respect to the most pervasive ones in childhood.
Jairo and his family moved to the US last year from Spain. Jairo is having trouble with his English pronunciation. He does well with the decodable words, or wor
what is the measure of <B, in degrees. ​
Ilarawan ang Paaralang Elementarya ng Upper Bicutan
The perimeter of a rectangle is 10 feet, and the area is 6 square feet. What is the width of the rectangle?
Jerry lives in a city where all the roads are organized into square blocks and the roads either run North/South or East/West (forming a big square grid). Jerry
Determine the total number of roots of each polynomial function. g(x) = (x - 5)^2 + 2x^3
Don’t need to explain, but if you want to then go ahead!