Hi, just having a problem at the moment with my code. its only part of the code from the class
public void execute()
{
buffer = new Buffer();
System.out.print("Line number: ");
int pos = Integer.parseInt(getInput());
buffer = editor.getCurrentBuffer();
System.out.println(pos +": " +buffer.getLines().get(pos-1));
buffer.setPos(pos-1);
editor.setCurrentBuffer(buffer);
}
What im trying to do is, when i type in the command goto, it will print the line number in which i chose. example when i type goto, then press 3, it will print out line numbeer 3. but the problem im having is, when i type in goto, 0 which is the line number, it gives me an error.
how could i fix this so that when i type goto, 0 line, it print out the following
Line number: ?
Thanks