import java.util.Scanner; // headers MUST be above the first class
// one class needs to have a main() method
public class HelloWorld
{
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
Scanner scan = new Scanner("abcdef/ghijkl/out/");
scan.useDelimiter("/");
while(scan.hasNext())
{
System.out.println(scan.next());
}
}
}
この作品です。
キーボード(System.in)用のスキャナを開いているにもかかわらず、キーボード入力の値をどこにも保存していない可能性があります。おそらく、私はいつものJavaを教えクラスで行っているように、変数へのご入力を設定するとよいでしょう:
Scanner scan = new Scanner (System.in);
String input = scan.nextLine(); // input: "abcdef/ghijkl/out/"
String[] stringArray = input.split("/");
for(String i : stringArray)
{
System.out.println(i);
}
がよろしいですことをどのように多くの文字列(各文字列は「/」で区切られている)あなたが読む必要があります? – cse