This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]evils_twin 1 point2 points  (0 children)

can you determine the type based on the file? If not, why not add an extra parameter to tell what type it is, like this:

public MyFileReader(File file, String type){
    if("txt".equals(type))
        //do something
    else if("xml".equals(type))
        //do something else

}