小编Ber*_*van的帖子

Java splitting input

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 …

java string split input

3
推荐指数
2
解决办法
2万
查看次数

JOptionPane输出文本副本

我没有经验,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文件(第二个会很棒).

java swing text joptionpane output

1
推荐指数
1
解决办法
7810
查看次数

标签 统计

java ×2

input ×1

joptionpane ×1

output ×1

split ×1

string ×1

swing ×1

text ×1