创建一个只有 4 个字母的文字扭曲游戏的下一步应该是什么?使用 Permulations 这就是想法:这是我的代码:
import java.io.*;
import javax.swing.JOptionPane;
public class sample {
public static void main(String[] args) {
String []a = new String[4];
a[0] = JOptionPane.showInputDialog("Input 1st character");
a[1] = JOptionPane.showInputDialog("Input 2nd character");
a[2] = JOptionPane.showInputDialog("Input 3rd character");
a[3] = JOptionPane.showInputDialog("Input 4th character");
JOptionPane.showMessageDialog(null, a[0] + " " + a[1]+ " " +a[2]+ " " +a[3] + " is the Letters");
}
}
用户将输入 4 个字母,然后程序将生成可以为输入的字母创建的任何单词。