how to resolve the error while using Scanner class in java -
I have created a class "mine" in which I'm taking input from the user using the scanner class. " >
import java.util.Scanner; square mine {public static zero main (string [] args) {int val; scanner sc = new scanner (System.in); System.out.println ("any Do not enter = "); Val = sc.nextInt (); System.out.println (" number "+ val);}} but I'm getting the following errors: < / P>
My.java:1: Can not resolve symbols: square scan Location: Package usage import java.util.Scanner; My.java:8: Can not resolve symbol symbol: square scanner location: package usage java.util.Scanner scanner = new java.util.Scanner (System.in); My.java:8: Can not resolve symbol symbol: square scanner location: package usage java.util.Scanner scanner = new java.util.Scanner (System.in);
import java.util.Scanner; ` You can name your scanner Can keep scans but to change the `scanner` in the body of your code
`java.util.Scanner` does not need to call the imported package to declare an object. update import java.util.Scanner; Square my {public static zero main (string [] args) {int val; Scanner sc = new scanner (System.in); System.out.println ("none enter"); Val = sc.nextInt (); System.out.println ("number" + val); }}
Comments
Post a Comment