I'm designing a file handler interface:
public interface FileHandler
{
public void openFileHandler(String fileName);
public void closeFileHandler();
public String readLine();
public String [] parseLine(String line);
public String [] checkLine(String line[]);
public void incrementLineCount();
public void incrementLineSuccessCount();
public void incrementLineErrorCount();
public int getLineCount();
public int getLineSuccessCount();
public int getLineErrorCount();
}
It is soon apparent to me that these methods can't be made private. I don't want incrementLineCount to be public.
What is proper way to design an interface like this?
private void openFileHandler(String fileName);
. I get an error:Illegal modifier for the interface method openFileHandler; only public & abstract are permitted
private
methods in interface. In fact all the methods in an interface are by default: -public abstract
.. I said thathave them as private method
in your implementing class..