Tutorials Point


  Java Basics
  Java Object Oriented
  Java Advanced
  Java Useful References
  Java Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Java - atan2() Method


previous next AddThis Social Bookmark Button


Description:

The method Converts rectangular coordinates (x, y) to polar coordinate (r, theta) and returns theta.

Syntax:

double atan2(double y, double x)

Parameters:

Here is the detail of parameters:

  • X and Y co-ordinates in double data types

Return Value :

  • Returns theta from polar coordinate (r, theta)

Example:

public class Test{ 
   public static void main(String args[]){
     double x = 45.0;
     double y = 30.0;

     System.out.println( Math.atan2(x, y) );
   }
}

This produces following result:

0.982793723247329


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names