Results 1 to 3 of 3
Thread: Scanner problem
- 10-28-2010, 12:48 AM #1
Member
- Join Date
- Oct 2010
- Posts
- 2
- Rep Power
- 0
Scanner problem
i want the Scanner to read data from a file...
Scanner sc = new Scanner(new File("file"));
but now i'm trying to type the file as a parameter in the console, because i don't want to change the code each time i load a different file
i tried this..
Quote:
Scanner sc = new Scanner(new File(System.in));
but - fail.
maybe sb can help me please, thy mkay (:
- 10-28-2010, 12:54 AM #2
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 10
Why don't you make a Scanner to get filename and then reassign that Scanner to a FileReader with the filename as a paramater
- 10-28-2010, 01:09 AM #3
Similar Threads
-
Problem with scanner
By JavaJ in forum New To JavaReplies: 6Last Post: 03-16-2010, 09:51 PM -
Problem with while loop and the scanner method
By hhh80p in forum New To JavaReplies: 2Last Post: 02-28-2010, 12:47 PM -
Problem with scanner
By Kangaroo128 in forum New To JavaReplies: 11Last Post: 09-01-2009, 09:07 AM -
Problem with scanner in loop
By grifan526 in forum New To JavaReplies: 2Last Post: 07-21-2009, 01:06 AM -
Scanner input problem
By slayer_azure in forum New To JavaReplies: 3Last Post: 05-26-2008, 11:49 PM
Bookmarks