- Java code
dollars = Long.parseLong(stringAmount, substring(0,length-3));cents = Long.parseInt(stringAmount, substring(length-2,length));
substring 都为小写,,,,但是上下两个substring都画着红线无法编译,,显示无法编译,,
试问一下这是为什么啊?
谢谢
------解决方案--------------------
dollars = Long.parseLong(stringAmount, substring(0,length-3));
cents = Long.parseInt(stringAmount, substring(length-2,length));
替换成
dollars = Long.parseLong(stringAmount.substring(0,length-3));
cents = Long.parseInt(stringAmount.substring(length-2,length));
逗号换成.
。。。