[英]Converting a for loop to a while loop with this "while (songInfo != null)"
public static void main(){
String songInfo = MediaFile.readString();
//System.out.println(MediaFile.readString());
for (int x=10; x>0; x--){
System.out.println(MediaFile.readString());
}
MediaFile.saveAndClose();
}
I need to convert the above for loop to a while loop using the condition我需要使用条件将上面的 for 循环转换为 while 循环
while (songInfo != null)
Not sure what the trouble is, but it sounds like you're looking for this:不确定问题是什么,但听起来您正在寻找这个:
while (songInfo != null) {
System.out.println(songInfo);
songInfo = MediaFile.readString();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.