aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes renameTo() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "renameTo() " Watch "renameTo() " New topic
Author

renameTo()

Prateek Rawal
Ranch Hand

Joined: Dec 19, 2009
Posts: 90
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?


Waiting for enlightenment....
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

How do you tell, that the program doesn't give Exception, you should check it. Try the below code..


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Prateek Rawal
Ranch Hand

Joined: Dec 19, 2009
Posts: 90
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

Joined: Nov 04, 2009
Posts: 2066

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.
 
subject: renameTo()