What are the values stored in variables r1 and r2:

  1. double r1 = Math.abs(Math.min(-2.83, -5.83));
  2. double r2 = Math.sqrt(Math.floor(16.3));

Views 5

Answer:

  1. r1 has 5.83
  2. r2 has 4.0
Explanation
  1. Math.min(-2.83, -5.83) returns -5.83 as -5.83 is less than -2.83. (Note that these are negative numbers). Math.abs(-5.83) returns 5.83.
  2. Math.floor(16.3) returns 16.0. Math.sqrt(16.0) gives square root of 16.0 which is 4.0.

Related Articles:

This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.

Join Our telegram group to ask Questions

Click below button to join our groups.