i'm trying to write a simple code for my project if user types
walk 10
i need to use "walk" command in my walk(distance) method as distance = 10 i have something like that
while (!quit) {
Scanner in = new Scanner(System.in);
String input = in.nextLine();
// if (walk x is typed) {
walk(x);
}
}
Run Code Online (Sandbox Code Playgroud)
i'm using java.util.scanner and another problem is that my method walk(int x) uses int so i need to convert String input to int
i …
我没有经验,JOptionpane但我需要一个简单的程序来简化我的生活.我需要帮助的代码如下:
public static void main (String[] args) {
String input = "";
input = JOptionPane.showInputDialog("Enter code");
JOptionPane.showMessageDialog(null, toStringU(toArray(input)), "RESULT",
JOptionPane.INFORMATION_MESSAGE);
}
Run Code Online (Sandbox Code Playgroud)
toStringU 方法给了我很长的文字
我想在没有任何编译器的情况下运行它(独立应用程序,双击,放置信息并获取结果).
我无法复制输出面板的结果,我需要复制它.所以要么我需要复制它和/或我想将它写入txt文件(第二个会很棒).