Friday 19 April 2019

java.util.scanner - Java Code User Input to System.out

Small programming question here.



I'm trying to get line 43



System.out.print("Please Enter the Manufacturer of Your Doughnut:"); 



user input to paste directly into line 46



System.out.print("Please Enter the Manufacturer of Your Doughnut:"); 


but my compiler keeps giving me this error:




Exception in thread "main" java.util.InputMismatchException at

java.util.Scanner.throwFor(Scanner.java:864) at
java.util.Scanner.next(Scanner.java:1485) at Torus.main(Torus.java:46)




For example, if the user wanted to input that their doughnuts were from McDonald's, line 46 would automatically spit out McDonald's.



My Java Code

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...