import java.util.Scanner;
import java.nio.file.*;
public class PathDemo2
{
public static void main(String[] args)
{
String name;
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter a file name >> ");
name = keyboard.nextLine();
Path inputPath = Paths.get(name);
------- Code here -----
System.out.println("Full path is " + fullPath.toString());
}
}
Using the above code, add a statement on the indicated line that creates an absolute path by assigning the file to the current directory.
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q67: Explain the difference between an absolute path
Q68: When a String is written, placing each
Q69: import java.nio.file.*;
import java.nio.file.attribute.*;
import java.io.IOException;
public
Q70: FileChannel fc = null;
Path file =
Q71: Describe and provide an example of the
Q73: import java.nio.file.*;
public class PathDemo
{
public
Q74: How can you assign program output to
Q75: import java.nio.file.*;
import java.io.*;
public class ReadEmployeeFile2
Q76: import java.nio.file.*;
import java.io.*;
public class ReadFile
Q77: writer.write(names, 0, names.length());
The above code represents
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents