//imports
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//vars
double x = 5;
Boolean y = true;
while (y){
String x = sc.nextLine();
y = false;
}
System.out.println(x); // x should output the String but doesn't.
//how do I fix this or is there a different way?
}
}
如果有帮助,我正在处理的实际代码。
https://replit.com/@AlexanderJensen1024/Tests#Main.java
我试图将变量设为 null 以回答别人的问题。