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: 
The design depends on many parameters, such as, who is going to use this method. Is it going to be overloaded, is it internal, package level or public API. I would tend to be general and offer two overloaded methods:

* one which passes in the `Path` which is a common way of specifying the path to a file
* and one which passes in the `InputStream`, i.e. general representation of input stream of bytes

public void normalizeData(Path filePath) //Path is a common way for specifying file path

public void normalizeData(InputStream) //general representation of input stream of bytes

But as I said, it depends on your project specification.
It depends whether you want the file hanlde outside the normalizeData method or inside it only. If you want to do something on file prior or after calling your normalizeData method then create a file object outside normalizeData method and pass the reference to the method. If ONLY your normalizeData method need to work on the file object then simply pass the filename to it.

Depends on your need and how you want to handle your file.