Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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.
 
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic