【发布时间】:2018-04-27 08:49:39
【问题描述】:
我需要像这样使用 for 循环和 long 值编写代码:
for(long i=1;i<lines.length; i++){
char tmp = lines[i].charAt(lines[i].length()-1);
int index = lines[i].lastIndexOf(" ");
lines[i] = lines[i].substring(0, index);
if(tmp != lastChar)
lines[i] = "S" + lines[i];
else
lines[i]=" "+lines[i];
lastChar = tmp;
}
问题是:incompatible types:possible lossy conversion from long to int我不知道怎么解决
【问题讨论】:
-
如果您提到这是哪种编程语言会有所帮助
-
我猜,Java
-
是的,Java sry 没有提到这一点
标签: java for-loop if-statement int long-integer