+ 1

More types

how can I enter the choice in char?... it's not working when I did it... https://code.sololearn.com/c1tNXRybs4or/?ref=app

21st Sep 2018, 3:40 PM
mn121
mn121 - avatar
1 Respuesta
0
Accept input as String, then grab the first character off the String as a char. String s = in.readLine(); char op = s.charAt(0); switch(op) { case '+': // code here break; case '*': // code here break; // more cases here } Hth, cmiiw
22nd Sep 2018, 1:49 AM
Ipang