Hi

I have a skeleton code in which i want to implement an open and new command.

The code is given below:

import java.util.*;
import java.io.*;
import java.io.FileNotFoundException;

public class Editor
{
public static final Scanner keyboard = new Scanner(System.in);
String fileName;
// Change this! An editor should have a "list" of buffers.
private Buffer buffer;

public Editor()
{
init();
run();
}

private void init()
{
buffer = new Buffer();

}

private void run()
{
System.out.print("> ");
String command = keyboard.nextLine();
if (command.equals("quit"))
{
System.out.println("Bye!");
System.exit(0);
}

else if (command.equals("line"))
{
buffer.printLineNumber();
}

else
{
System.out.println("?");
}

// You will probably like your application to loop at this point.
}

// Make this a proper application.
// Don't remove this line!
public static void main(String[] args) { new Editor(); }
{

}

}

So, i want to implement a command called open, which will open up a buffer, the command asks for additional information by printing "File name:" The user can then enter a file to start the new buffer

The new command, should creates an empty new buffer and it should associates it with a file name, the command will ask for additional information by also printing "File name:"

hope to hear from you, help would be much appreciated

regards:mad: