Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

This is my code below: 

  package trigger;

   import java.util.Scanner;

   public class Trigger {

    public static void main(String[] args) {

        System.out.println("Please input known values");

        Scanner input = new Scanner(System.in);

        System.out.println("Angle A");

        String Ain = input.next();

        System.out.println("Angle B");

        String Bin = input.next();

        System.out.println("Angle C");

        String Cin = input.next();

        System.out.println("Side A");

        String ain = input.next();

        System.out.println("Side B");

        String bin = input.next();

        System.out.println("Side C");

        String cin = input.next();

    }

}

The following code gives me an error like this:

 java.lang.ExceptionInInitializerError

Caused by: java.lang.RuntimeException: Uncompilable source code - cannot find symbol

symbol:   class Scanner

location: class java.util

at trigger.Trigger.<clinit>(Trigger.java:2)

Exception in thread "main" C:\Users\******\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1

BUILD FAILED (total time: 0 seconds)

Can anyone tell me why I’m not able to import Java “import java.util.Scanner” ?  

1 Answer

0 votes
by (19.7k points)

Right-click the project name -> Properties -> Build -> Compiling. Then uncheck “compile on save”. Hope this helps. 

Interested in Java? Check out this Java Certification by Intellipaat. 

Browse Categories

...