How to get the extension of a file using Java

How to get the extension of a file using Java

Submitted by donbermoy on
Today, I will teach you how to create a program that get the extension of a file using java. For example if we input a text file of .txt file extension then the output will be .txt. So, now let's start this tutorial! 1. Open JCreator or NetBeans and make a java program with a file name of extensionFile.java. 2. Import java.io package.