Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

renameTo()

 
Prateek Rawal
Ranch Hand
Posts: 90
  • 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
  • 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
  • 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic