This is my Code
public class Workshop3
{
public static void main (String [] args)
{
System.out.println (\"please enter radius of circle\");
Please add the following line on top of your code
*import java.util.*;*
This should resolve the issue
You need to include the line import java.util.Scanner;
in your source file somewhere, preferably at the top.
You have to import java.util.Scanner at first line in the code
import java.util.Scanner;
sometimes this can occur during when we try to print string from the user so before we print we have to use
eg: Scanner scan=new Scanner (System.in);
scan.nextLine(); // if we have output before this string from the user like integer or other dat type in the buffer there is /n (new line) which skip our string so we use this line to print our string
String s=scan.nextLine();
System.out.println(s);
You can resolve this error by importing the java.util.*
package - you can do this by adding following line of code to top of your program (with your other import
statements):
import java.util.*;
Add import java.util.Scanner; at the very top of your code. Worked for me.