1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kap26 [50]
3 years ago
14

What method of the Math object can be used to return the largest value from the values that are passed to it?

Computers and Technology
1 answer:
miss Akunina [59]3 years ago
7 0

Answer:

the Math.max() method

Explanation:

The java.lang.* package contains all the essential components needed for a JAVA program which involves numbers and all the operations done on the numericals.

The java.lang.math class contains all the methods needed to perform mathematical operations on numerical values.

All the methods in the question are discussed below with examples.  

Math.max() method

java.lang.Math.max(double/ int/ float a, double/ int/ float b)

This method returns the highest value from among the parameters passed to it.

The syntax for the above is  

Numbers can be integers, float and double or long. The return type is the same as the parameters.

Two values to be compared are passed as arguments and the higher value of them is returned.

This function also accepts negative integers as parameters.

Math.max(-9, -2);

Gives -2 as the output.

Math.max(0.34, 0.45)

Gives 0.45 as the output.

Math.ceil() method

java.lang.Math.ceil(double/ int/ float a)  

This method returns the nearest greater whole number for the given number.

Integer parameter returns an integer number.

Math.ceil(7);

Gives 7 as the output.

Decimal number will return the nearest higher integer.

Math.ceil(8.7);

Gives 9.0 as the output.

Math.ceil(-0.34)

Gives -0 as the output.

Math.pow() method

java.lang.Math.pow(double/ float/ int a, double/ float/ int b)

The above method returns the result of a raise to the power of b.

The first parameter is the base while the second parameter forms the exponent.

Math.pow( 2.3,  4.5 );

This calculates (2.3)^4.5.

Gives 42.44‬ as the output.

Math.pow( 2, 3 );

This calculates the value of 2^3.

Gives 8 as the output.

Math.abs() method  

java.lang.Math.abs(double a)

This method returns non-negative value of the numerical parameter passed to it. Absolute of a number does not changes its value but changes the sign of a negative number. It returns the positive or negation of the negative input number.

Math.abs(-0.1234)

Gives 0.1234 as the output.

Math.abs(12.34)

Gives 12.34 as the output.

These methods require java.lang.Math to be imported in the program.

You might be interested in
What was the job of the Committee of Correspondence? WILL GIVE BRANLEST AND 40 POINT
Wewaii [24]

Answer:

how many of these information have you shared

5 0
2 years ago
Two devices that may be used for creating,storing,and transmitting documents input devices
castortr0y [4]

Answer:

electronic notebook or a pc?

Explanation:

sorry if its wrong of doesnt help

6 0
3 years ago
PLS HELP ASAP- Select the correct text in the passage.
SCORPION-xisa [38]

Answer:

reread the text

Explanation:

I do it it helps

5 0
2 years ago
Read 2 more answers
What is the function of ROM?
Gnoma [55]

Answer:

Hello, There!

<h2>Your Question↓</h2>

What is the function of ROM?

<h2>Answer↓</h2>

Allows parts of the computer to communicate is the Correct Answer.

Explanation:

<h2>Now you May Ask What does it do or How it works↓</h2>
  • ⇒ROM provides the necessary instructions for communication between various hardware components.
  • ⇒ it is essential for the storage and operation of the BIOS, but it can also be used for basic data management, to hold software for basic processes of utilities.

Tip: Wanna know how to earn points back for asking your Question?

If you do it's easy just when two people answer your question whichever answer you think is the best click the crown on the side to get 25% of your points back! :D

Therefore, I hope this helps!

6 0
2 years ago
Sets of rules that a computer uses to solve problems?
jonny [76]

Protocal

I need to make this 20 charaters so ye

8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the QOS model?
    6·1 answer
  • What is the name of the contextual or specific tab that appears in page layout view when adding a header
    15·1 answer
  • A biologic reaction is produced by 4 Gyt of a test radiation. It takes 16 Gyt of 250-kVp x-rays to produce the same biologic rea
    11·1 answer
  • Name similarities between innovation and invention
    6·1 answer
  • A cybersecurity analyst is currently investigating a server outage. The analyst has discovered the following value was entered f
    9·1 answer
  • Grooves and polished surfaces on desert pebbles are most likely caused by
    10·1 answer
  • What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y =50; if ( x &gt;=
    7·2 answers
  • Why might you complete a 1040 instead of a <br> 1040ez
    11·2 answers
  • Which of the following is true for an API?
    6·1 answer
  • Outline three difference each of a raster filled and vector file​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!