星期一, 12月 18, 2006

sample code of a class with static methods

public class RoundStuff
{
public static final double PI=3.14159;

public static double area(double radius)
{
return (PI*radius*radius);
}

public static double volume(double radius)
{
return((4.0/3.0)*PI*radius*radius*radius);
}
}

沒有留言: