0
java why?
Why doesn't this code work? https://code.sololearn.com/c5q2qS5UIplu/?ref=app
2 Answers
+ 2
your my_var is an Scanner object. Through this you can use it's methods and for accepting int value as input use nextInt() method of Scanner object so use like
cont(my_var.nextInt()); # not cont(my_var);
+ 2
Bogyo - LeČia Eduard
Read the error message "Scanner cannot converted to int" means my_var is an object which cannot be a integer value so you should pass integer value in your method because your method accepts integer. So take integer input using Scanner class object and pass in method.