Results 1 to 2 of 2
  1. #1
    jellora is offline Member
    Join Date
    Mar 2012
    Posts
    7
    Rep Power
    0

    Default 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);	
    }
    }
    i'm getting error like this....
    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............

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: read emailid and seperate print names in a list and domain in another list

    Read the API doc for the BufferedReader class and see how to code its constructor. The compiler can not find one that takes a String.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. How to print the content of List
    By cassysumandak in forum New To Java
    Replies: 4
    Last Post: 10-01-2009, 10:36 AM
  2. Finding the most repeated names in a list
    By jboy in forum New To Java
    Replies: 2
    Last Post: 09-17-2009, 03:08 PM
  3. output for list of names in a format
    By Ms.Ranjan in forum New To Java
    Replies: 7
    Last Post: 06-18-2009, 04:47 PM
  4. Replies: 0
    Last Post: 04-07-2009, 10:35 PM
  5. Replies: 0
    Last Post: 03-03-2009, 08:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •