My code, for starters:
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;
import java.util.Locale;
import java.util.Arrays;
// Updated file with my own code
public class TextExcel {
public static void main(String[] args) {
//command loop:
Scanner sc = new Scanner(System.in);
String userinput;
String[] arrOfStr;
userinput = sc.nextLine();
Map<String, String> cells = new HashMap<String,String>();
while(!(userinput == "quit")) {
if(userinput.contains("=")) {
arrOfStr = userinput.split("=");
cells.put(arrOfStr[0], arrOfStr[1]);
}
if(userinput.contains("cell")) {
arrOfStr = userinput.split(" ");
cells.get(arrOfStr[1]);
System.out.println(cells.get(arrOfStr[1]));
}
userinput = sc.nextLine();
}
System.exit(0);
}
}
When I type the following into the console, the following error appears:
----jGRASP exec: java TextExcel
A1 = hi
cell A1
null
quit
quit
quit
>:(
----jGRASP: process ended by user.
While the "quit" not functioning is not my main problem, I would like help figuring that one out as well. What can I do to make the values callable?
PS I did do the debugging on the Hashmap, and both the value and the key are recorded, but for some reason calling the name returns null.