switch statements need a jumpable index so can’t use strings or general expressions in all C based languages - others do allow switching on a string, but last I checked, not Java, and not on an expression like the above definitely.
That said, if it were any more complex then I’d advise having a tokeniser and a switch statement on the token ID. Just trying to keep my example simple enough for anyone to follow as I have no idea what level people are at with their coding, so applying the entirety of my 20+ years as a coder might not get the best result…
As for the actual Java console, that lives in the systray when a Java applet starts, no - to my knowledge there is no access to it, but definitely not for input anyway.
One other thing I would recommend tho: make your console app exactly that - something you can run from the command line and use straight text input/output, and have a layer handling input/output that can be swapped for the applet version.
This allows you to quickly test stuff even if the applet interface is not ready yet, and allows you to itterate its form e.g. you have a commandline (cmd window) layer, a version 0 applet layer that has a text field for input and another for output but no prettyness, and a version X one that is as fancy as you want, if you have time to work on it. Meanwhile the core code is separate and can be worked on independently.