Java FileNameFilter example to list files with specific extension

If you need to pick up specific extensions from the given directory and you ask yourself how to filter files using Java. Should implement java FilenameFilter class and override accept() method. Then pass object to list() method to get specific file extensions. Java FileNameFilter example will show you all these stuffs.

Run the java … Read more

Two ways compare Java Double

This sample shows two ways compare Java Double object with another Double object or two dobule primitive values using methods of java.lang.Double class

Output First number is greater Value c1 = 1 Second number is greater Value c2 = -1

How to loop collection using Iterator object?

I show you three ways to loop collection using Iterator object. Hope you like and choose one to implement for your code. Although there are other ways to do but i recommend these ways for you. Iterate via “iterator loop” The hasNext() method returns true if the iteration has more elements. The next() method returns … Read more

Please share it if you found this useful
Hide Buttons