If you're writing a Java program using Windows Text Document, the simple notepad program, you'll notice that when you save the file it defaults to a .txt file naturally. In order for Command Prompt to properly read and compile the program, the file extensions must be changed to a .java. We can do this by highlighting the .txt at the end of the file name and replacing it with .java, but you may notice a problem. The file type will still remain a Text Document even though you see it says .java. All that happens is .java gets added to the extension, even though you don't see it. For example, if you're file was Java1.txt it would now be Java1.txt.java or Java1.txt.txt or Java1.java.txt and these will not work. We want the file to be Java1.java. How we do this is very simple, follow the steps below:
The Tutorial:
1: Click Start
2: Click Control Panel
3: Click Appearance And Personalization
4: Click Folder Options
5: Once Inside Folder Options select the View tab
6: Scroll until you find Hide extensions for known file types and uncheck the box to the left (see above image for reference)
7: Click OK and you're done!
Now you'll see the true file extensions in your folder and can adjust them accordingly. To make your Java1.txt.java file proper, simply highlight the .txt.java and replace it with .java. Furthermore when you change the file type you'll be prompted with a pop up box that says "If you change a file name extension, the file might become unusable. Are you sure you want to change it? Click OK.
If you found this tutorial useful, please leave a comment below and visit my Java Page for more tutorials, information and projects!