Using mathematical functions in Java?

lotus0o -  
 ray-J -
Here is the translation: Here, in Java, I import the java.lang.Math library
but I still can't use functions like cos or sin.
I have to use java.lang.Math.cos(double) in my code, is that normal?

Second question, is it possible to find a library that calculates the average of a list of numbers?

2 answers

ray-J
 
Salut, enfin je ne comprends pas. Normalement, le package java.lang, on n'a pas besoin de l'importer, c'est une bibliothèque standard puisque tous les objets l'utilisent, vu que tous les objets dérivent de java.lang.Object.
3
Sims'
 
Hello,

normally, once you have imported the java.lang.Math library, you should be able to directly use your cos function by doing "Math.cos(double);" since it's a static method.

However, for your second question, I don't know of any library that performs this kind of operation. But it's not very complicated to program... with a loop, you should be able to manage it...
2