CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 18

Threaded View

  1. #9
    Join Date
    Jul 2007
    Posts
    273

    Re: newbie: exception handling (and Eclipse)

    Quote Originally Posted by keang View Post
    If you'd read the link I gave you you would have seen you can put multiple statements in a single try block. So you just need to put all five methods calls within the one try block.
    Maybe my situation is a little different:
    Code:
    //Main
    MyObject ob = new MyObject();
    
    class MyObject {
        public MyObject() {
                  method1();
        }
     public  void Method1() throws IOException, XMLStreamException{
               int event = xmlreader.next();
               if (event == ...........................) {
                   method2();
                ..................
    
                }
      }
    public void Method2() throws IOException, XMLStreamException{
               int event = xmlreader.next();
               if (event == ..................... ) {
                   method3();
                ..................
    
                }
    
      }
    }
    }
    SO I repeat my question: must I put try/catch inside each MethodX either I can put one in main class?
    Last edited by mickey0; July 6th, 2010 at 10:21 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
  •  





Click Here to Expand Forum to Full Width

Featured