View Single Post
Old 08-03-2008, 02:44 AM   PM User | #1
twodayslate
Senior Coder

 
twodayslate's Avatar
 
Join Date: Mar 2007
Location: VA
Posts: 1,042
Thanks: 67
Thanked 39 Times in 39 Posts
twodayslate is on a distinguished road
Scanner cannot be resolved to a type

Just installed eclipse having not been programming for a month...
Code:
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:
Code:
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)
Code:
~$ 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.
__________________
twitter | Quality Hosting - $5.95/mo*
Feel free to PM me!

Last edited by twodayslate; 08-03-2008 at 03:12 AM..
twodayslate is offline   Reply With Quote