+ 1

How To scan input as a path in string var in java?

String str = scanner.XXXX(); //What is XXXX for take input as Path. //IF any other way tell me please...

26th Jun 2022, 6:03 AM
RTB
RTB - avatar
2 odpowiedzi
+ 3
if input is keyboard or text file get string by .nextLine() and convert it to correct path
26th Jun 2022, 6:31 AM
zemiak
+ 1
If you mean a directory, it is used for other methods (eg. JFileChooser) in a form of String. So you use standard next or nextline methods just as you would normally for getting a String from the Scanner
26th Jun 2022, 6:34 AM
Nick