Results 1 to 2 of 2
- 03-25-2012, 08:55 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 7
- Rep Power
- 0
read emailid and seperate print names in a list and domain in another list
desired o/p:
tina gmail com
meena yahoo in
sheena rediff com
Java Code:import java.io.*; import java.lang.String; import java.util.*; public class s1 { public static void readFromFile(String pathToFile) { final BufferedReader reader = new BufferedReader(pathToFile); try { String line = null; while ((line = reader.readLine()) != null) { final StringTokenizer tokenizer = new StringTokenizer(line, "@,","."); final List<String> columns = new ArrayList<String>(); while (tokenizer.hasMoreTokens()) { columns.add(tokenizer.nextToken()); } } reader.close(); } catch (IOException e) { throw new IllegalArgumentException("Error reading file (" + pathToFile + ")", e); } } public static void main(String args[]) { String pathToFile="f:/java_src/mailid.txt"; readFromFile(pathToFile); } }
F:\java_src\files\s1.java:8: cannot find symbol
symbol : constructor BufferedReader(java.lang.String)
location: class java.io.BufferedReader
final BufferedReader reader = new BufferedReader(pathToFile);
^
1 error
help me to sort it out............
- 03-25-2012, 10:25 PM #2
Similar Threads
-
How to print the content of List
By cassysumandak in forum New To JavaReplies: 4Last Post: 10-01-2009, 11:36 AM -
Finding the most repeated names in a list
By jboy in forum New To JavaReplies: 2Last Post: 09-17-2009, 04:08 PM -
output for list of names in a format
By Ms.Ranjan in forum New To JavaReplies: 7Last Post: 06-18-2009, 05:47 PM -
get list of all ip/host names connected on a network
By a_maged in forum NetworkingReplies: 0Last Post: 04-07-2009, 11:35 PM -
JAVA-SAX-Xml how to get simple tag element names to a list
By SumanReddyg in forum XMLReplies: 0Last Post: 03-03-2009, 09:46 AM
Bookmarks