我想通过用户 System.in 将我的单词添加到我的 input_words 中,我尝试在网上查看并且我确实测试了很多方法,但它不起作用。任何人都可以帮忙吗?
在我的代码中,当我运行它时,它会要求我放入 String1、2、3...7,但我想将其放入 input_words。
谢谢...
这是我的代码。
public static void main(String[] args) {
ArrayList<String> input_words = new ArrayList<String>();
input_words.add("SCHOOLWORKTWO");
input_words.add("BALCONY");
input_words.add("INSIST");
input_words.add("SALTPETER");
input_words.add("BOLTON");
input_words.add("KITSCHY");
input_words.add("CLIENTELE");
String s1 = getInput("Enter a String String 1: ");
String s2 = getInput("Enter a String String 2: " );
String s3 = getInput("Enter a String String 3: " );
String s4 = getInput("Enter a String String 4: " );
String s5 = getInput("Enter a String String 5: " );
String s6 = getInput("Enter a String String 6: " );
String s7 = getInput("Enter a String String 7: " );
System.out.println(s1 + ", " + s2+", " + s3+", " + s4+", " + s5+", " + s6+", " + s7); // Should use this string as input_words.add Array
System.out.print(getTiles(input_words, DEFAULT_SPLITTER)); // Make sure to use DEFAULT_SPLITTER
}