本帖最后由 Friends★ 于 2012-5-3 22:51 编辑
import java.util.Scanner;
class Test20
{
public static void main(String args[])
{
System.out.println("请输入要转换的数字:");
Scanner sc=new Scanner(System.in);
int num=sc.nextInt();
if(num>0){
System.out.println(num*(-1));
}
if(num<0){
System.out.println(num*(-1));
}
if(num==0){
System.out.println(0);
}
}
public static void sop(Object obj)
{
System.out.println(obj);
}
} |