error messages

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2007
Posts: 33
Reputation: realnsleo is an unknown quantity at this point 
Solved Threads: 0
realnsleo realnsleo is offline Offline
Light Poster

error messages

 
0
  #1
May 2nd, 2007
hi there, how can i display an error message in java and stop compile program at that point of the error?
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 46
Reputation: lucky1981_iway is an unknown quantity at this point 
Solved Threads: 3
lucky1981_iway's Avatar
lucky1981_iway lucky1981_iway is offline Offline
Light Poster

Re: error messages

 
0
  #2
May 2nd, 2007
Use try catch block for this purpose
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 33
Reputation: realnsleo is an unknown quantity at this point 
Solved Threads: 0
realnsleo realnsleo is offline Offline
Light Poster

Re: error messages

 
0
  #3
May 2nd, 2007
Originally Posted by lucky1981_iway View Post
Use try catch block for this purpose
how do i do that???
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 706
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 84
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: error messages

 
0
  #4
May 2nd, 2007
Originally Posted by realnsleo View Post
how do i do that???
try{
// code that you want to run
}
catch(NullPointerException nEx){
// what you want it to do or show when a nullpointerexception occurs
}
catch(Exception ex){
// what has to be done in case of another exception
}

a more simple form (the simplest) of this structure is:

try{
// actual code
}
catch(Exception ex){
// what has to be done in case of any exception
}
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC