Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Showing exception

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Showing exception

    when i call the see method in another class by a try-catch statement i m getting the exception message
    see method is called by an actionlistener of an JButton...plz help me fix this
    public class Check{
        private  Scanner in;
        String a, b, c, d, m2;
        //opening file
        public void openFile(){
            try{
                in = new Scanner(new File("couple.txt"));
            }catch(Exception e){
                JOptionPane.showMessageDialog(null,"ERROR 002");
            }
        }
        //getting data from file
        public  void readFile(){
            while(in.hasNext()){
                a = in.next();
                b = in.next();
                c = in.next();
                d = in.next();
                m2 = in.next();
            }
        }
        //checking for couple(emailing) OR recording
        public void see(String cn, String ce, String un, String ue,String m1)throws IOException{
            if (b == ce && d == ue) {
                //we have a coupple
                email e = new email();
                e.Sendmail(ce,un,m1);
                e.Sendmail(ue,cn,m2);
            }else{
                Record r = new Record();
                r.addRecords(cn,ce,un,ue,m1);
            }
        }
        //closing file
        public void closeFile(){
            in.close();
        }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,421
    Thanks
    49
    Thanked 2,215 Times in 2,188 Posts

    Default Re: Showing exception

    i m getting the exception message
    Please copy the full text of the error message and paste it here. It has important info about the error.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,132
    My Mood
    Mellow
    Thanks
    187
    Thanked 659 Times in 646 Posts

    Default Re: Showing exception

    Welcome to the forum! Thanks for taking the time to learn how to post code correctly. If you haven't already, please read this topic to learn other useful info for new members.

    It would also be helpful if you'd post runnable code that demonstrated the error or at least includes all of the parts mentioned in the error message.

Similar Threads

  1. Replies: 4
    Last Post: February 20th, 2013, 09:01 AM
  2. Replies: 1
    Last Post: February 6th, 2013, 10:21 AM
  3. Replies: 3
    Last Post: March 6th, 2012, 02:50 AM
  4. Replies: 5
    Last Post: September 5th, 2011, 10:31 AM
  5. Replies: 6
    Last Post: March 25th, 2011, 03:42 PM