carriemariah1409 carriemariah1409
  • 14-07-2019
  • Computers and Technology
contestada

Which of the following would compile without error? A. int a = Math.abs(-5); B. int b = Math.abs(5.0); C. int c = Math.abs(5.5F); D. int d = Math.abs(5L);

Respuesta :

PhantomWisdom PhantomWisdom
  • 16-07-2019

Answer:

int a = Math.abs(-5)

Explanation:

Math.abs() is the function which gives the absolute value of the integer.

syntax:

Math.abs(int name);

the argument enter must be integer(int).

int b = Math.abs(5.0): here, 5.0 is not the integer, it is float. So, it gives error.

int c = Math.abs(5.5F): here, 5.5F is not the integer, it is float. So, it gives error.

int d = Math.abs(5L): L stand for long but it is not int. So, it also gives error.

Therefore, the correct result is int a = Math.abs(-5), -5 is integer.

Answer Link

Otras preguntas

The part of the brain responsible for voluntary, or conscious, body activities and emotions is located in the Frontal Lobe or Cerebrum o.O
Write the ratio as a fraction in simplest form. 10 ft to 5 yds
“[F]reedom of conscience, freedom of person, freedom of trade and business pursuits, universality of freedom and equality. This is our high destiny, and in natu
Evaluate the expression when a = 4. 2a^3 A. 14 B. 24 C. 128 D. 512
Square root of -121 and simplify it please and show me steps
A number s is subtracted from seven. When the result is divided by three, the quotient is two. What is the number?
What is a sentence with the word Evasively?
The planet we call earth has how many layers
wendy's brother drank 3/10 of the gallon of milk in the fridge. what percent of the milk did he drink.
what set off a European scramble for African territories