|
-
September 27th, 1999, 07:56 AM
#1
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
-
September 29th, 1999, 05:11 AM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|