0

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..

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by NPH
0

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
}
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.