Question: I have a couple of methods which take filenames as parameters. My doubt is that what is better way to declare the parameters of these methods. 

* Should the parameter be of type `String`

```
void normalizeData(String inFile)

```
* Or should I explicitly declare the parameter as `File`.

```
void normalizeData(File inFile)

```

Personally I find `File` more intuitive but want to know about what is the best practice for such things.

Answer: 
Think about using multiple overloaded methods to give the user of the API the choose.

Also think about passing an `InputStream` as it is possible that the user of the API wants to use any in memory representation of the data.
If you pass the string, you have control in the method over how the file is opened, and the file handle managed. You are centralising that code. If you pass the `File` object, then you are duplicating the file handling code everywhere this is called. So I'd have a strong preference for the former.