Asked • 05/13/19

Convert from Radians to Degrees in Java?

I'm trying to get the alpha angle in degrees from x,y when user creates an object. I wrote the following constructor: public class Point { private double _radius , _alpha; public Point ( int x , int y ) { _radius = Math.sqrt ( Math.pow(x,2) + Math.pow (y,2) ) ; _alpha = ( ( Math.atan (y/x) ) * 180 ) / Math.PI; } } 1. Am I right that _alpha is now an angle in degrees instead of radians that I got from the atan() method ? 2. Is there a simple way to do so ? Thanks !

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.