Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wanna know answers of these.........?

 
Harjeet Dadwal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are some questions
1) what is difference between getPath() and getAbsolutePath() in file handling ?
2) what is difference between Reserve word or Keyword in JAVA and how many keywords are there in java ?
3) where can we get exercises or assignments of different java topics, just for practice ?
------------------
Harjeet Singh Dadwal
 
greg philpott
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are some answers:
1) getPath() returns the abstract pathname and getAbsolutePath() returns the full pathname.
example. try this to see for yourself:

2) Both Keywords and reserved words cannot be used as identifiers. The difference is keywords have special meaning in the language and reserved don't. There are 46 keywords and 2 reserved words.
3) http://www.javaranch.com/cattledrive.jsp
 
James Gray
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good answers above, but I would say that getPath() returns a "relative" path. Here's a mock example from a unix web server:
f.getPath() == "images/photo.jpg"
f.getAbsolutePath() == "/usr/httpd/images/photo.jpg"
The first one shows the path from the current working directory, while the second is the entire path from the root of the hard drive.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic