Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+8 votes

When creating a new File object where does the Path start for the Pathname String?

asked in CSC 305 Fall 2024 by (1.1k points)

1 Answer

+7 votes
 
Best answer

The path should start from your computer's main folder if it’s an absolute path (like /home/user/file.txt). If it’s a relative path (like docs/file.txt), it starts from the folder where your program is running. You can find that folder using System.getProperty("user. dir")

answered by (285 points)
selected by
...