In this example we are find the current Temp directory.
We are using getProperty(String key) method to find the current temp directory. The getProperty(String key) is defined into System class. System class extends directly Object class. System class is defined final so any class never extends System class. System class allow us to get or set system information. In this example we are pasing "java.io.tmpdir" as key to get the current temp directory into getProperty() method.
The code of the program is given below:
The output of the program is given below:
C:\convert\rajesh\completed>java TempDirExample OS current temporary directory is C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: June 29, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles