I'm using BlueJ. I have a program that uses the Scanner without any issues in the same project. I have another program that compiles, but does not execute. On the BlueJ project screen it shows "Work indicator: indicates when virtual machine is executing".
Here is my code which I don't think is incorrect.
import java.util.Scanner;
public class Testing
{
public static void main( String[] args)
{
Scanner scan = new Scanner( System.in );
double radius = scan.nextDouble();
double circumference = (2*Math.PI*radius);
double area = (Math.PI*radius*radius);
System.out.println(circumference);
System.out.println(area);
}
}
I've tried changing the name of the scanner( ex. scan ) to that of the class that works, and it didn't fix it. I'm not getting any errors at all.
I also made a new class where you simply input something into the Scanner and it prints it out onto the screen, and it doesn't work either. Help?
EDIT: I just needed to add System.out.println( "Enter Radius: " );
before the scan.nextDouble()
for the terminal window to pop up. Thank you.
I just needed to add System.out.println( "Enter Radius: " );
before the scan.nextDouble()
for the terminal window to pop up. Thanks everyone.