|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
发信人: bloodflower (面条), 信区: Java
标 题: Re: 请教String、Char[]与Integer的问题
发信站: BBS 水木清华站 (Tue May 28 08:39:08 2002)
是不是你自己的char[]数组构造的有问题啊?
我写了一个测试,没有问题啊。
- public class test
- {
- public static void characters(char[] ch, int start, int length)
- {
- String propValue = new String(ch,start,length); //把字符数组转化为Stri
- ng
-
- System.out.println(propValue+"s"+start+"l"+length);
- Integer intValue = new Integer(propValue);
- System.out.println(intValue);
- }
- public static void main(String[] args)
- {
- char[] ch = new char[5];
- String temp = "12rty";
- temp.getChars(0, 5, ch, 0);
- characters(ch, 0, 2);
- }
- }
复制代码
【 在 windwe 的大作中提到: 】
: 谢谢。
: 不过还是一样的错误。不知是不是用char[]构造的String特殊。
: 【 在 Elric (钻石恒久远,一颗永留传) 的大作中提到: 】
: : int intValue = Integer.parseInt(propValue);
: : 我也忘的差不多了,你自己试试吧 |
|