I'm doing an assignment that implements the following interface

public interface MyStackInterface {
    public Character pop();
    public void push (Character c);
    public boolean isEmpty();
    public void clear ();
}

The objective is to properly arrange parenthesis, brackets, and braces. I was wondering should I use a data file or try to hard code them into the program. And if I should use a text file, I'm asking about some ideas on the scanner interface that is used to do this..

What do you mean use a data file, text file and the other stuff? An interface is implemented like this:

class Test implements MyStackInterface
{
    //now it must override the methods
}

The scanner interface can be used to read lines, tokens, etc.

Suppose you want to open a file named "c:\test.txt" using the Scanner:

Scanner sc = new Scanner(new File("c:\\test.txt"));

To read all the lines from the file using the created scanner:

while(sc.hasNextLine())
{
    String scLine = sc.nextLine();

    //process line
}

What is the input file supposed to look like? What should the output of the program be?

:?: For more help, www.NeedProgrammingHelp.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.