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

    Exciting Question

    Hi friends

    if its not an exciting question Sorry! it's a doubt for me
    Assume i have a function, and i calculate some value of say "yyy"(variable). while calculating if i get value of yyy=-1000 i.e in negetive value. I have to raise the exception that" invalid value" and my programm should continue.
    this is just like, if i got wrong array index, if i put try cacth of ArrayIndexoutofBounds exception, my program should continue without halting.

    How to write throwing exception and continue functionality for my program (variable yyy.) . please Give ana example????
    it's really urgent for me..

    Thans
    Sona



  2. #2
    Join Date
    Sep 1999
    Posts
    7

    Re: Exciting Question

    Code is

    public class Sample2
    {
    public static void main(String[] args)
    {
    try
    {
    int i = -5 ;
    if( i == -5 )
    throw new Exception("sa");
    }
    catch ( Exception e)
    {
    System.out.print("Invalid value");
    }

    }

    }


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