• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The method list(FilenameFilter) in the type File is not applicable for the arguments (FilenameFilter

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have pasted my code at the bottom and I am getting the following error. The example is picked from "Thinking in Java" by Bruce Eckel. Would you please let me know the problem with the below mentioned code?

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method list(FilenameFilter) in the type File is not applicable for the arguments (FilenameFilter)
at com.sample.InnerClass.main(InnerClass.java:37)

-----------------------
 
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to pass an instance of a class that implements the java.io.FilenameFilter interface - not your own interface called FilenameFilter.
 
Ranch Hand
Posts: 287
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The author was only showing you the interface and what all methods it contains. You don't have to re-invent the wheel.

As told by the above poster, pass an instance of java.io.FileNameFilter. so remove that interface from your compilation unit and you should be good.
 
Rajkumar Masanaiyan
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Harsha Smith wrote:The author was only showing you the interface and what all methods it contains. You don't have to re-invent the wheel.

As told by the above poster, pass an instance of java.io.FileNameFilter. so remove that interface from your compilation unit and you should be good.



Thank you Joanne & Harsha.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic