Hi, I'm using Java and I'm having trouble with the input type. I'm using Scanner(System.in), but I'm keep getting run time error even though I'm not getting this error in my local code editor.
Is this the correct way to get input?
Hi, I'm using Java and I'm having trouble with the input type. I'm using Scanner(System.in), but I'm keep getting run time error even though I'm not getting this error in my local code editor.
Is this the correct way to get input?
Thank you so much!
Do not new Scanner(System.in)
twice.
Use one scanner to read all the input.