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\
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.