What is the output from System.out.println((int)Math.random() * 4)?

a. 0
b. 1
c. 2
d. 3
e. 4


a Casting is performed before the * operator in (int)Math.random() * 4 . So, it returns 0.

Computer Science & Information Technology

You might also like to view...

Which of the following statements best describes the term padding?

A) It determines the space between controls in a report or form. B) It is a tool that combines records with identical values from a field in a report. C) It is a tool that displays data containing only specified values. D) It is a control that enables your active applications to interact with another application across the web.

Computer Science & Information Technology

Three basic necessities need to be taken care of when facing a disaster situation: water service, ________, and basic cleaning. These are the responsibility of the facilities support team

Fill in the blank(s) with correct word

Computer Science & Information Technology

With a suitable parallel processor, a search for the largest of 1,000,000 numbers requires (2*lgN), or ____ steps.

A. 1 B. 500 C. 40 D. 1,000,000

Computer Science & Information Technology

The forward slash (/) is used to identify a statement as a comment. _________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology