201 Flashcards
Say me PI & Exponent Constant from java.lang.Math class
double E
doble PI
Why we need utilities like this Math Class?
As java is subjective, there are times when we do not have the time to write the implementation & at the same time to save the DRY principle, it is good to use utilities & carry our work. But we should keep practising to write utilities.
Say the method for trigonometric functions from java.lang.Math class?
double sin(double a) double cos(double a) double tan(double a) double asin(double a) double acos(double a) double atan(double a)
What is the function for exp & log in java.lang.Math class?
double exp(double a) double log(double a)
What is the most general argument type and return type of Math class?
double
What is the function for sqrt & pow in Math class?
double sqrt(double a) double pow(double a, double b)
What is the function for ceil & floor
double ceil(double a ) double floor(double a)
Is there a function to generate a random int in MAth class?
Yes, double rint(double a)
How can we do a round of double and float?
int rount(float a ) double round(double a)
If float and double both belongs to Float type, then why we have two overloaded methods for float and double
TBF
What is java.lang.StrictMath class?
The StringtMAth class is more standaridsed, providing more functions compare to java.lang.Math class. In case if portability is a concern, we should use StrictMath class
What is overflow and underflow in Math
TBF
How to obtain the cuberoot in StrictMath?
static double cbrt(double a)
Does many methods in StrictMath are static?
Yes
How to return the hyperbolic cosine?
static double cosh(double a)