Java: String Var in switch statements | IDE Error. Help!!!!
Java did not support using String variables in switch statements until after the release of Version 7. Even though I have JRE 8 and JDK 11, I was told that Eclipse may still be compiling, or running, my code with a default JRE or JDK that is outdated. The problem only arises when I use string variables in switch statements. I would really prefer to fix my IDE, so I can use String variables in switch statements opposed to using if/else statements. The reason being is that I am following a tutorial closely and I would rather stay on task and do it the same. I would appreciate any help. My code and the youtuber's source code is here --> https://code.sololearn.com/c0NG13LtSs87/#java UPDATE @ 9 Dec. 2018 11:52 EST For whatever reason, I could not get any of my compilers to compile and run the double switch statement. Though the problem never was solved, I have a resolution. Change the String variable, position, to an int variable and use the following chart. /* Position Variable Settings * 11 = townGate(); * 12 = talkGuard(); * 13 = attackGuard(); * 14 = crossRoad(); * 15 = north(); * 16 = east(); * 17 = west(); * 18 = fight(); * 19 = playerAttack(); * 20 = monsterAttack(); * 21 = win(); * 22 = lose(); * 23 = ending(); * 24 = defeatedMonster(); * 25 = beginNewGame(); */ ( I added a couple more of my own) The variables begin at 11 instead of 01 because I encountered yet another glitch where variables 08 and 09 are not recognized. [I like the irony how the workaround needed a workaround. lol] Proper coding habits, such as separating everything into classes, makes this glitch to never appear. In the tutorial, I am positive that the reasoning behind putting everything into one class file was to give a base understanding, of how java works, to someone who has never coded before. In his next set of tutorials he separated everything into classes properly and this glitch did not affect me. I am doing my best to document my enti