Link to home
Start Free TrialLog in
Avatar of javamate06
javamate06

asked on

Checking the extension of the file

If I have a file which has name  name.zz

I want to check

if (name have extension zz)
{
//      Do something
}
else
{
System.out.println(“The file is not a zz file”);
}


Is there a way to check the extension of the file?
ASKER CERTIFIED SOLUTION
Avatar of bpmurray
bpmurray
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of javamate06
javamate06

ASKER

Thank you....

if (name.lastIndexOf(".zz") == name.length() - 3)