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());
}
}
}
This Works.
Your problem may be that you are opening a Scanner for the keyboard (System.in), but you aren't storing the value of your keyboard input anywhere. You would probably want to set your input to a variable, like I have always done in classes that taught 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);
}