import java.io.*;
public class Test {
public static void main(String[] arg){
Console console=System.console();
String chessPiece="";
int rowEnd=0;
char columnEnd = ' ';
System.out.println("what piece do you want to move?");
chessPiece=console.readLine();
System.out.println("where do you want to move it to?(type column letter)");
String input=console.readLine();
columnEnd=input.charAt(0);
System.out.println("where do you want to move it to?(type row number)");
rowEnd=Integer.parseInt(console.readLine());
}
}
if i put this into a notepad and launch it, it works, but with eclipse it tells me:
what piece do you want to move?
Exception in thread "main" java.lang.NullPointerException
at Test.main(Test.java:14)
why??