suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
阅读:2298回复:7

弱问Java菜鸟问题

楼主#
更多 发布于:2007-10-07 02:04
SCJP_GUIDE看方法重载,写了段做测试
public class Same{
	public static void main(String argv[]){
		Same s = new Same();
		int iBase = 0;
		float iAlpha = 0.234;
		s.amethod(iBase, iAlpha);
	}
	public void amethod(int iBase, float iAlpha){
		System.out.println("Over.Base.Alpha");
	}
	public void amethod(float iAlpha, int iBase){
		System.out.println("Over.Alpha.Base");
	}
}


报错!
Same.java:5 可能损失精度
找到: double
需要: float
                float iAlpha = 0.234;
                               ^
1 错误

把float 改成 double就可以了
why?
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
0000
作家
作家
  • 铜币143枚
  • 威望34点
  • 贡献值1点
1C#
发布于:2007-10-07 18:19
Re:弱问Java菜鸟问题
默认小数是 double 类型,你可以写 float iAlpha = 0.234f;


SCJP是要看书的
.--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
2C#
发布于:2007-10-09 00:00
Re:弱问Java菜鸟问题
推荐个书吧...
孙淑琴的那个我打算看了这个GUIDE之后再去看
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
3C#
发布于:2007-10-09 00:02
Re:弱问Java菜鸟问题
英文版的亦可
看同事的Oreilly版的Java Server Pages,貌似很浅显易懂的样子
但是基础不行啊
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
0000
作家
作家
  • 铜币143枚
  • 威望34点
  • 贡献值1点
4C#
发布于:2007-10-10 17:54
Re:弱问Java菜鸟问题
SCJP跟JSP八杆子打不到一块,就SUN官方那本考试用书~~名字忘了,SCJP+SCJD,好像就叫
Sun Certificated Java Programmer
.--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
永
著名写手
著名写手
  • 铜币90枚
  • 威望18点
  • 贡献值0点
5C#
发布于:2007-10-11 09:19
Re:弱问Java菜鸟问题
还是看不明白
我们都是普通人,普普通通的老百姓! 但是我们也有自己的思想,我们也有自己的语言,精辟的言语不光是出自社会知名人士,不光出自上层名流!
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
6C#
发布于:2007-10-11 09:51
Re:弱问Java菜鸟问题
JSP不是好玩么...
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
7C#
发布于:2007-10-11 09:59
Re:弱问Java菜鸟问题
其实我的意思是   oreilly的那本书难的写的不是很冗长太浅显...

ps:Java ROR和 沢井芽衣 啥关系..
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
游客

返回顶部