DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    2

    Question NegativeArraySizeException

    Hi, I'm wondering if anyone can illustrate how I can throw the above exception using Try/Catch ?

    Thanks.

  2. #2
    Join Date
    May 2004
    Posts
    219
    You mean you want to catch NegativeArraySizeException?

  3. #3
    Join Date
    Feb 2004
    Posts
    541
    You can throw anything you like using the keyword throw....

    Code:
    try
    {
        //some code here
    }
    catch(SomeException e)
    {
        throw new AnythingYouLike();
    }

    If it is a checked exception (ie not a runtime exception), then your method has to declare that it may throw it using the keyword throws after the method declaration, ie
    Code:
    public void myMethod throws MyException

  4. #4
    Join Date
    Jul 2004
    Posts
    2

    Smile

    Guys, thank you all for your help - problem now solutioned.

  5. #5
    Join Date
    Feb 2004
    Posts
    808

    Re: NegativeArraySizeException

    Originally posted by javanovice
    Hi, I'm wondering if anyone can illustrate how I can throw the above exception using Try/Catch ?

    Thanks.
    heh, so decide.. do you want to throw, or do you want to catch? the two are rather.. er.. opposite things, you know
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links