File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

renameTo()

 
Prateek Rawal
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K & B P.No: 456 states that:

you must give valid new File object with the new name you want. If the new file object is null, NullPointerException will be thrown


Consider the code:


Line 01 must throw NPE but it doesn't.....a new directory with name "name" is created in the current directory and the programs compiles and runs successfully....
What should i conclude?
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you tell, that the program doesn't give Exception, you should check it. Try the below code..
 
Prateek Rawal
Ranch Hand
Posts: 90
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm really sorry for the question, i asked a silly query...

Anyway thanks Abimaran

PS: I hope i referred you right this time
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prateek Rawal wrote:
Anyway thanks Abimaran
PS: I hope i referred you right this time


Welcome!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic