• 0

Eclipse problem


Question

Any clue why the hell this is happening?

import java.util.*;

And it says it is never used even though I used it.

Scanner is highlighted saying it is not a type.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

import java.util.*;
public class ValidateCheck {

	public static void main(String[] args) {
  System.out.println("Enter a 10-digit check number:");                 
  Scanner sc = new Scanner (System.in); 
  String number = sc.next();
  int zeroCount = 0, nonZeroCount = 0;
  
  int index = number.length();

Just some of the code, but the lines:

import java.util.*;

Scanner sc = new Scanner (System.in);

Those lines are problems since it says it never uses java.util.* and the Scanner is not resolved or is not a type.

Link to comment
Share on other sites

  • 0

Dunno where u saw a Scanner class in the java.util package... It's not in my JRE (1.4.2).

BTW, don't write import manually. In Eclipse, hit Crl-Shift-o and it will automatically import all needed packages, and ask you if multiple choices are available.

For example, in my Eclipse, there are 2 Scanner classes: one in java_cup.runtime and one in org.apache.batik.css.parser

Link to comment
Share on other sites

  • 0
Dunno where u saw a Scanner class in the java.util package... It's not in my JRE (1.4.2).

BTW, don't write import manually. In Eclipse, hit Crl-Shift-o and it will automatically import all needed packages, and ask you if multiple choices are available.

For example, in my Eclipse, there are 2 Scanner classes: one in java_cup.runtime and one in org.apache.batik.css.parser

584732873[/snapback]

its in 1.5 .. did you have 1.4 installed before ? maybe your Eclipse is still using that. Check what libraries it is using.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.