Question #111893

What value(s) will be output by the following Java code statements?

System.out.println( (int)(Math.random()*8) + 1 ); _________________

System.out.println( Math.abs( -5 ) ); _________________

System.out.println( Math.abs( 6 ) ); _________________

Expert's answer

System.out.println( (int)(Math.random()*8) + 1 ); random integer number in [1,8]

System.out.println( Math.abs( -5 ) ); 5

System.out.println( Math.abs( 6 ) ); 6



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS