Skip to content

Instantly share code, notes, and snippets.

@rayjcwu
Created January 20, 2014 06:45
Show Gist options
  • Save rayjcwu/8516000 to your computer and use it in GitHub Desktop.
Save rayjcwu/8516000 to your computer and use it in GitHub Desktop.
You are teaching Java by way of geometry problems. Your work requires Math.PI, Math.cos, Math.sin and other Math package functions. You would prefer to simply use the simple names (e.g. PI, cos, sin) without the Math. or java.lang.Math. prefixes. How do you accomplish that? 1. Declare that GeometryLesson aliases java.lang.Math. 2. Declare that G…
class GeometryLesson {
static double degreesToRadians (double d) {
return (Math.PI / 360) * d;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment