首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

java里面使用Math.sin的有关问题

2012-01-08 
java里面使用Math.sin的问题为什么没有像c++那样事先声明 Math的对象?难道Math是静态类?[解决办法]不是因

java里面使用Math.sin的问题
为什么没有像c++那样事先声明 Math的对象?

难道Math是静态类?

[解决办法]
不是 因为sin是静态方法 你可以试一下。 新建一个类Test, 然后在类Test里面写个静态方法a,

那么你可以在别的类中通过test.a()调用a方法, Math.sin同上
[解决办法]
不是静态类,但

Java code
    /**     * Returns the trigonometric sine of an angle.  Special cases:     * <ul><li>If the argument is NaN or an infinity, then the      * result is NaN.     * <li>If the argument is zero, then the result is a zero with the     * same sign as the argument.</ul>     *      * <p>The computed result must be within 1 ulp of the exact result.     * Results must be semi-monotonic.     *     * @param   a   an angle, in radians.     * @return  the sine of the argument.     */    public static double sin(double a) {    return StrictMath.sin(a); // default impl. delegates to StrictMath    } 

热点排行