Jave Error: import java.util.Scanner;

Posted on 2009-04-01
Last Modified: 2012-05-06
I am taking a college course in Jave and I am very new at this.  I have been trying to compile some code and I keep getting this error: cannot resolve symbol
symbol  : class Scanner
location: package util
import java.util.Scanner;
                 ^ cannot resolve symbol
symbol  : class Scanner
location: class AverageGrades
       Scanner input = new Scanner ( );
       ^ cannot resolve symbol
symbol  : class Scanner
location: class AverageGrades
       Scanner input = new Scanner ( );
3 errors

import java.util.Scanner;
import javax.swing.*;
public class AverageGrades {
   int count;
   public double enterGrades () {
       Scanner input = new Scanner ( );
       double grade = 0;
       double sum = 0;
       int gradeCounter = 0;
     // Enter grades
     System.out.println( "Enter grades (Grade of 0 causes average calculation: ");
     grade = input.nextDouble();
     //calculate the total of all grades entered
     for (gradeCounter = 0; grade != 0; gradeCounter++ ){
        sum = sum + grade;
        System.out.println( "Enter grades (Grade of 0 causes average calculation: ");
        grade = input.nextDouble();
     count = gradeCounter;
     return sum;
   public double aveGrades (double sum ) {
   //calculate the average
     double average = 0;     
     average = (double) sum / count;
     System.out.println( "The grade average is " + average );
     return average;
     public static void main(String[] args){
     AverageGrades aGrades = new AverageGrades();
     double sum = aGrades.enterGrades();
     System.out.println("Sum : "+sum);
     double average = aGrades.aveGrades(sum);
     System.out.println("Count : "+aGrades.count);
     System.out.println("Average : "+average);
     } // end Main
} // end Class

Open in new window

Question by:JudyTillman
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 92

Expert Comment

ID: 24046025
Scanner was only added in 1.5, make sure you have a 1.5+ version of jdk
LVL 26

Accepted Solution

ksivananth earned 125 total points
ID: 24047136
even if you have installed multiple version of Java and the older version is set in path  could lead problem.

check java version by executing java -version

if it prints older( < 1.5 ) version of JDK, modify the path variable to refer the latest

Author Closing Comment

ID: 31565623
With me being new to Java and programming it was difficult to find the right JDK pack.  However on my 3rd download of items from    I finally found the right JDK pack.  Thanks you.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
throw exception 21 69
printf performancy 11 86
Html Table Looping (part 2) 5 35
junit example issue 2 28
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question