PDA

View Full Version : Scanner cannot be resolved to a type


twodayslate
08-03-2008, 03:44 AM
Just installed eclipse having not been programming for a month...
import java.util.*;
public class twod {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("How many rows?");
int rows = in.nextInt();
System.out.println("How many columns?");
int columns = in.nextInt();
double[][] table = new double[rows][columns];

double input;

for(int r = 0; r < rows; r++)
{
for(int c = 0; c < columns; c++)
{
System.out.println(r + "," + c + " :");
input = in.nextDouble();
table[r][c] = input;
}
}

for(double[] e : table)
{
System.out.print(e);
}
}//end main
}//end

error: Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Scanner cannot be resolved to a type
Scanner cannot be resolved to a type

at twod.main(twod.java:5)
~$ java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
I hope I did the 2D arrays right.