Question
I have a question of the java code. I am currently using netbeans IDE8.2 and I put the code package javaapplication1; /** * * @author
I have a question of the java code. I am currently using netbeans IDE8.2
and I put the code
package javaapplication1;
/** * * @author */ public class JavaApplication1 {
/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here double radius; double PI = 3.14; System.out.println("Enter the radius : "); scanner input = new scanner(System.in); radius = input.nextDouble(); if(radius <=0){ System.out.println("The value entered for radius is invalid. Please enter a positive interger"); } else{ double area = PI*radius*radius; System.out.println("Area: "+ area); } } }
After I run the code, it says that
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - constructor scanner in class javaapplication1.scanner cannot be applied to given types;
required: no arguments
found: java.io.InputStream
reason: actual and formal argument lists differ in length
at javaapplication1.JavaApplication1.main(JavaApplication1.java:23)
C:\Users\home\AppData\Local\NetBeans\Cache\8.2\executor-snippets un.xml:53: Java returned: 1
BUILD FAILED (total time: 5 seconds)
would u tell me how to fix?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started