Point A = new Point(); short a = 93, b = 92; int i = 12, j = 13; long x = 0, y = 44; double u = 13.45, v = 99.2; A.move( i, b ); // OK --- b can be converted to int without loss A.move( a, x ); // NOT OK --- converting x to int may lose magnitude and precision A.move( u, b ); // NOT OK --- converting u to int may lose magnitude and precision
double
Parameter
The cos()
method is a static method of the Math class.
(Remember that a static method is a method that belongs to the definition of the
class; you do not need an object to use it.)
Here is how the method looks in the documentation for the Math class:
public static double cos( double num )
The method requires a parameter of type double
.
It evaluates to (returns) a double
, the cosine of the parameter.
The parameter is in radians (not degrees.)
Here is it being used in a program:
class CosEg { public static void main ( String arg[] ) { double x = 0.0; System.out.println( "cos is:" + Math.cos( x ) ); } }
Is the parameter in the method call the correct type?