The user has to choose which tree to use:
Which tree would you like to test (BST, ST, RBT)?
I thought you could just take the input as a string and compare it to a string to pick which tree to use but I think im wrong, below is what ive done
Scanner input = new Scanner(System.in);
System.out.println("Which tree would you like to test (BST, ST, RBT)? ");
treeChoice = input.nextLine();
if(treeChoice == "BST")
{
myTree = new BST<Integer>();
}
else if(treeChoice == "ST")
{
//ST<Integer> myTree = new ST<Integer>();
}
else if(treeChoice == "RBT")
{
//RBT<Integer> myTree = new RBT<Integer>();
}
else
{
System.out.println("Invalid Entry");
}
That doesnt seem to be working, when i tested it the output was invalid entry.
am I going about this the wrong way?