This is the program which show error that program is right that will post by fault. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

This is the program which show error that program is right that will post by fault.

https://code.sololearn.com/cQ3g46Kt84Y7/?ref=app

23rd Jan 2019, 11:51 AM
Raj Kiran Singh
Raj Kiran Singh - avatar
2 Answers
+ 2
Your program doesn't now what is Scanner. It is located at an external component and you should indicate a place where this class can be found. import java.util.Scanner
23rd Jan 2019, 12:23 PM
Earl_Grey
Earl_Grey - avatar
+ 2
There are 2 ways of solving your problem. 1. Add import java.util.*; at the top of the code. 2.Change Scanner sc=new Scanner(System.in); to var sc = new java.util.Scanner(System.in);
23rd Jan 2019, 12:35 PM
Seniru
Seniru - avatar