当前位置: 代码迷 >> Java相关 >> 这个abs方法 和 instanceof运算符 该怎么用?
  详细解决方案

这个abs方法 和 instanceof运算符 该怎么用?

热度:279   发布时间:2006-07-29 19:13:32.0
我觉得你既然以前的都忘了 就干脆找本书从头学起吧
有很多最基础的东西你都不明白
我17楼的程序

----------------解决方案--------------------------------------------------------
真是强中还有强中手,一山更比一山高。。。
----------------解决方案--------------------------------------------------------
以下是引用韩峰在2006-7-29 17:52:31的发言:
上面那个的有问题

public class Test

{

private int a;

public Test(int a)

{

this.a=a;

abs(this.a);

}

public static void abs(int a)

{

System.out.println(Math.abs(a)); //这个为什么不写在最下面呢

}

public static void main(String args[])

{

new Test(-1);

}

}



感觉这个程序写得好复杂 可以简单一点的

我现在正在从头开始看书 刚开始看就有些不明白 所以就在论坛里面想问个清楚

太感谢你了 也感谢论坛里帮过我的朋友们

[此贴子已经被作者于2006-7-29 19:21:21编辑过]


----------------解决方案--------------------------------------------------------
public class Test {
public static void main(String [] args){
System.out.println(Math.abs(-1));
}

}


----------------解决方案--------------------------------------------------------
~`       大致上明白了    !
----------------解决方案--------------------------------------------------------
  相关解决方案