public class Passcode
{
public static void main(String[] args)
{
System.out.printf("%5s","What is the password\n"); // ask user what the code is//
String flake= StdIn.readString();// take in input from user//
String cake= "cookie"; // not complete yet but will use this in an if statement//
}
}
答案 0 :(得分:1)
我认为程序中的StdIn.readString
来自外部程序包。可能来自普林斯顿的java包吗?
如果是这样,你应该:
import abc.def.StdIn;
CLASSPATH
。您可以在google上找到有关如何执行此操作的大量有用信息。答案 1 :(得分:0)
我认为您的import语句可能缺少某些内容。您可能想尝试以下代码:
import java.io.*;
public class Passcode
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.printf("%5s","What is the password\n"); // ask user what the code is//
//String flake= StdIn.readString();// take in input from user//
String flake = br.readLine();
System.out.println(flake);
String cake= "cookie"; // not complete yet but will use this in an if statement//
}
}