I'm trying to compile this code so i can test it out but i get this error
Angle.java:18: illegal start of expression
public Angle ( double a , int units )
^
1 error
This is my code so far.
public class Angle
{
private double rads;
{
final static public int RADIANS = 0, Degrees = 1;
public Angle ( double a , int units )
if ( units == RADIANS) { setRadians(a); }
else if ( units == DEGREES) { setDegrees(a); }
else throw new RuntimeException( "Bad Units: " + units );
}
public double getRadians() { return radians; }
public void setRadians( double rads ) { radians = rads; }
public String toString() { return getRadians() + " Radians"; }
public double getDegrees() { return radians * 57.29577951; }
public void setDegrees( double degs ) { radians = degs * 0.0174532925; }
public String toString() { return getDegrees() + " Degrees"; }
}
I know its more than likely a syntax thing that im messing up although i feel like it could easily be something much bigger, any help to get me past this would be greatly appreciated.