当我尝试运行它时,它说console.readLine();
存在问题。console.readLine();错误;但在代码中看起来都正确吗?
import java.io.Console;
public class PingPong {
public static void main(String[] args) {
System.out.println("give me a number, honey?");
String stringYourNumber = console.readLine();
Integer yourNumber = Integer.parseInt(stringYourNumber);
System.out.println("Here ya go:");
for (Integer i=1; i <=yourNumber; i++){
if(i % 5==0 && i % 3==0){
System.out.println("PingPong");
} else {
if (i % 5==0){
System.out.println("Pong");
} else {
if (i % 3==0){
System.out.println("Ping");
}
}
}
}
}
它是否说_some problem_或**这个具体的问题就在这里,这个错误信息发生这个原因**? –
PingPong.java:8:错误:找不到符号 \t \t String stringYourNumber = console.readLine(); \t \t^ 符号:变量控制台 位置:类乒乓 1错误 –
请与相关的信息来更新您的问题,并解释你不理解的错误消息。 –