这样就能得到 ^_^
int x = Interger.parseInt("1") ;
int x = Interger.parseInt("1") ;
解决方案 »
- Spring3 + JPA2(hibernate3.6) + atomikos实现多数据源的问题
- 求助!论坛的楼数是如何实现的?
- 网页播放器不能用
- jsp页面中取数据库内的值
- 如何测试Struts2的action方法
- jsp项目上传虚拟主机后,类文件出错
- java如何关闭一JFrame窗体而不退出虚拟机-----System.exit(n)之类。
- 如何编写j2ee的远程独立客户端?
- 在JBuilder9 + Tomcat4.1.24 + MySql4.0.13-nt配置下程序不能正常运行,请高手帮忙
- java 调用 C++ 的问题!!!(100分奉送)
- 为何我的Tomcat 5.04设置了reload属性后,只能自动更新一次,就必须重新启动?
- 為什麼要實現持久化?
int x = Integer.parseInt("1") ;
也可以
System.out.println(x + "*****");
我试过了,结果是1呀!
为何x=0?怎么样转换才能得到string的值你要1你还是“1”
System.out.println(x + "*****");
我试过了,结果是1呀!----
晕,难道我看错了,我记得我明明返回一个0的呀,回去我在看看,先这样吧
public static int parseInt(String param) {
int i = 0;
try {
i = Integer.parseInt(param);
}
catch (Exception e) {
i = (int) parseFloat(param);
}
return i;
} public static long parseLong(String param) {
long l = 0;
try {
l = Long.parseLong(param);
}
catch (Exception e) {
l = (long) parseDouble(param);
}
return l;
} public static float parseFloat(String param) {
float f = 0;
try {
f = Float.parseFloat(param);
}
catch (Exception e) {
//
}
return f;
} public static double parseDouble(String param) {
double d = 0;
try {
d = Double.parseDouble(param);
}
catch (Exception e) {
//
}
return d;
} /**
* Parse a string to boolean.
* @param param string to parse
* @return boolean value, if param begin with(1,y,Y,t,T) return true,
* on exception return false.
*/
public static boolean parseBoolean(String param) {
if (nullOrBlank(param))
return false;
switch (param.charAt(0)) {
case '1':
case 'y':
case 'Y':
case 't':
case 'T':
return true;
}
return false;
}