0

When printing I want it to put out:

C Windows system

But the delimiter makes it so system does not show. What do I do?

    
    Scanner userInput = new Scanner (System.in); 

    userInput.useDelimiter("[/\n:/ /]");
 

    
System.out.print("Vilken sökväg?"); 
    
disk = userInput.next();
os = userInput.next();
where = userInput.next();
    



  System.out.println( disk );
  System.out.println( os );
  System.out.println( where );

userInput.close();
  }
}
  • It works fine for me. What is your input? – talex Oct 09 '22 at 12:06
  • That's a character class in your scanner delimiter and it looks quite wrong. What is it that you want to do? You talk about output but ```Scanner``` is actually only interested in input... – g00se Oct 09 '22 at 12:49
  • If your intention is to process file paths then there are better ways to do that such as using [Path](https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/nio/file/Path.html) – g00se Oct 09 '22 at 13:00

0 Answers0