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

bangmang,该如何处理

2012-03-01 
bangmang1.编写程序,用Math类求一个数的绝对值和最大值;并且自己也定义2个功能和Math类求一个数的绝对值和

bangmang
1.编写程序,用Math类求一个数的绝对值和最大值;并且自己也定义2个功能和Math类求一个数的绝对值和最大值的方法
2.编写程序,把一个IP地址(如:192.168.38.100)的最后2位变为*号,即变为192.168.*.*


[解决办法]

[解决办法]
1.public static void main(String[] args) {
Math.abs(-1);
Math.max(3, 4);
}

public float testAbs(float a){
if(a>=0){
return a;
}else 
return -a;
}

public float testMax(float a,float b){
if(a>b){
return a;
}
if(a==b){
System.out.println("a与b相等,输出a");
return a;
}else 
return b;
}

热点排行