Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
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
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:45 PM.


Advertisement
Log in to turn off these ads.