devxlogo

Interesting Java.lang.Math Class

Interesting Java.lang.Math Class

public class UsingLangDotMath
{
   final int TWENTY_SEVEN = 27;
   
   public static void main(String args[])
   {
      UsingLangDotMath usingLangDotMath = new UsingLangDotMath();
      usingLangDotMath.proceed();
   }
   
   private void proceed()
   {
      System.out.println(“Cube root of 27: ” + Math.cbrt(TWENTY_SEVEN));
      System.out.println(“Trigonometric sine: ” + Math.sin(TWENTY_SEVEN));
      System.out.println(“Trigonometric cosine: ” + Math.cos(TWENTY_SEVEN));
      System.out.println(“Trigonometric tangent: ” + Math.tan(TWENTY_SEVEN));
      
   }
}

/*
Expected output:

[root@mypc]# java UsingLangDotMath
Cube root of 27: 3.0
Trigonometric sine: 0.956375928404503
Trigonometric cosine: -0.2921388087338362
Trigonometric tangent: -3.273703800428119

*/

See also  Java Developer Jobs: Your Guide to Landing the Perfect Position in 2024
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist