Wednesday, September 26, 2007

Provide yourself an example (not one from your instructor) of how you use a particular command that will help jog your memory in the future when you need that command again. You must provide a little code as well as a written explanation with this one.

Today, I learned about a static class called Math. As primitives do not have a class (unlike strings), the Math method is used to do special calculations. It contains sqrt (square root), abs (absolute value), and many other similar methods. Here is an example:

double a=16;
System.out.println(Math.sqrt(a));
//this would print 4.0

This is, thus, a very useful method.

No comments: