 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can create a file so that you can store some data into that file in Java. Before starting, you can subscribe my YouTube channel by clicking on the bottom right corner of this video. You can download my app Takamis that is available on Google Play. You can connect with me by following these details which are available in front of you. Now I am going to demonstrate you the code which will create a file automatically so that you can store some data into that file. For that purpose, I have imported a class file which is available in iopex and iopex is available in javapex. Then create file is the name of class. Inside that main method is defined. Main is containing try and catch block. Try block is containing some statements in which first one is file obj file equals to new file and file 1.txt. This file 1.txt is name of file which we are going to create. This file is a class and obj file is object of this class. So this object will be linked with this file. Now if condition is containing obj file dot create new file. So this method will creating a file. If file is created successfully then if condition will be true and this message will be printed on console that is file created successfully. If file will not be created successfully then else will print file creation field. Then if any exception will be raised inside try block then control will be transferred to catch block and this system dot out dot printer and will print ex.to string. To string is predefined method which will display all the statements which are available inside ex reference and ex is referring to exception class. So friends this is simple demonstration which will create a file. So first I am going to show you the location where this file will be created. So right now I am working in the package named sanjay. So I am showing you the location of that package. So I am opening d drive inside d drive practice folder. So this package is available here. Location is d practice and sanjay. Inside sanjay you can see src is containing all source codes bin is containing all byte codes and remaining files and folders are available but no txt file is available here. Now I am going to execute this code. You can see the message file created successfully is displayed here. Now I am moving to the folder location. So here you can see that file one dot txt is also created and its size is 0 kb. It means it is right now blank. I am opening this. You can see that it is blank file. With the help of this simple demonstration I have created a txt file which you can use to store some data. That data will be stored permanently. This is related to file handling in java. So whenever you want to store anything into a file permanently then you have to create a file. So you can use this code for that purpose. I hope you have understood the concept well. If you want to watch more programming related videos you can subscribe my youtube channel. Thank you for watching this video.