0

What's wrong with this code?

I am trying to use Scanner to make my calculator, bot operation's input doesn't work. https://code.sololearn.com/cDrqeu2O28kr/?ref=app

6th Apr 2022, 6:54 PM
Programmer
Programmer - avatar
1 Réponse
+ 1
//One scanner object is enough. Others won't work for same stream. import java.util.Scanner; public class Program { public static void main(String[] args) { System.out.println("Please input a"); Scanner a = new Scanner(System.in); System.out.println(a.nextDouble()); System.out.println("Please input operation"); //Scanner op = new Scanner(System.in); System.out.println(a.next()); System.out.println("Please input "); //Scanner b = new Scanner(System.in); System.out.println(a.nextDouble()); } } //hope it helps
6th Apr 2022, 7:00 PM
Jayakrishna 🇮🇳