Math Class

Descripción

Diapositivas sobre Math Class, creado por Shannon Anderson-Rush el 08/09/2019.
Shannon Anderson-Rush
Diapositivas por Shannon Anderson-Rush, actualizado hace más de 1 año
Shannon Anderson-Rush
Creado por Shannon Anderson-Rush hace casi 5 años
1798
0

Resumen del Recurso

Diapositiva 1

    The Math class is another frequently used class that contains several methods: abs( ) returns the absolute value round( ) rounds to the nearest whole number ceil( ) rounds up floor( ) rounds down max(x, y) returns the larger value of x and y min(x, y) returns the smaller value of x and y pow(x, y) returns x to the power of y random( ) returns a double in the range [0, 1.0) sqrt( ) returns the square root
    Math Class Methods

Diapositiva 2

    Static Methods
    The methods in the Math class are static. Static means that the methods do not require the creation of an object in order to invoke them. They are invoked through the class name. Static methods are used when we will have the same result regardless of the object. For example, the abs( ) method will compute the absolute value of the number given every time. No individual object will change that computation.  Most Math methods will return a double value, however, there are some that return integers.

Diapositiva 3

    Examples
    System.out.println(Math.abs(-3)); System.out.println(Math.ceil(4.201)); System.out.println(Math.floor(5.511)); System.out.println(Math.max(1, -4)); System.out.println(Math.abs(-2, 0)); System.out.println(Math.pow(2, 3)); System.out.println(Math.round(3.59)); System.out.println(Math.sqrt(529)); System.out.println(Math.abs(-3));
Mostrar resumen completo Ocultar resumen completo

Similar

Scientific Notations
Cori Harper
Division - 10/5/17
Cori Harper
Enseñar con Fichas de Memoria
Diego Santos
PASAPALABRA  sobre  ANATOMÍA
JL Cadenas
Test Asociado al Reading "Social Network"
Diego Santos
PMP Prep
jorgeat
SELECTIVIDAD: Metas de Estudio SMART
maya velasquez
Qué Carrera Estudiar
Diego Santos
Clase Invertida paso a paso
Diego Santos