public class test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Please insert a word.: ");
String word = (" ");
while (in.hasNextLine()){
System.out.println(in.next().charAt(0));
}
}
}
入力から各文字を読み取り、スペースで区切ろうとしています。
例: 入力はYes.
出力は
Y
E
S
.
char を入力の次の文字に移動する方法がわかりません。誰でも助けることができますか?