What is the difference between getPath(), getAbsolutePath() and getCanonicalPath() in Java?

0 votes
Jul 24, 2018 in Java by shweta
• 440 points
218 views

1 answer to this question.

0 votes

  1. getPath() - returns a String which denotes the path that is used to create an associated File object, and it may be relative to the current directory
  2. getAbsolutePath() -returns the path string after resolving it against the current directory if it's relative, resulting in a fully qualified path
  3. getCanonicalPath() -returns the path string after resolving any relative path against the current directory and removes any relative path element e.g. (. and ..), and any file system links to return a path which the file system considers the canonical means to reference the file system object to which it points​
answered Jul 25, 2018 by Mrunal
• 680 points

Related Questions In Java

0 votes
2 answers

What is the difference between Set and List in java?

LIST SET Duplicates YES NO Order Ordered Depends on Implementation Positional Access YES NO List is an ordered sequence ...READ MORE

answered Aug 14 in Java by Sirajul
• 25,700 points
107 views
0 votes
2 answers

What is the difference between getAttribute() and getParameter() in java?

getParameter() returns http request parameters. Those passed from ...READ MORE

answered Aug 28 in Java by Sirajul
• 25,700 points
602 views
0 votes
2 answers

What is the difference between Type List and type ArrayList in Java

By List, you actually tell, that your object ...READ MORE

answered Aug 28 in Java by Sirajul
• 25,700 points
74 views
0 votes
2 answers

What is the difference between Map and HashMap in java?

The basic difference is : Map is ...READ MORE

answered Aug 28 in Java by Sirajul
• 25,700 points
173 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,380 points

edited Nov 6, 2018 by Omkar 8,180 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,090 points
1,993 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,090 points
5,189 views
0 votes
1 answer

Selenium JARS(Java) missing from downloadable link

Nothing to worry about here. In the ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,090 points
505 views
0 votes
2 answers

What is null in java?

"null" is a reference type and its ...READ MORE

answered Jul 31, 2018 in Java by Mrunal
• 680 points
34 views
0 votes
5 answers

How to compare Strings in Java?

String fooString1 = new String("foo"); String fooString2 = ...READ MORE

answered Jul 12, 2018 in Java by Daisy
• 8,050 points
116 views