Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java's exceptions for total beginner

 
André Asantos
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
can you help me with any clue how to learn Java's exceptions... Try/Cath/Finally... and the Java's exceptions...

thanks in advance!!!
André AS
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:http://java.sun.com/docs/books/tutorial/essential/exceptions/


let me guess, you googled 'java exceptions tutorial' and followed the first result ?
 
Henry Wong
author
Marshal
Pie
Posts: 20995
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian Janisch wrote:
let me guess, you googled 'java exceptions tutorial' and followed the first result ?


Actually, no. The Sun tutorial, for something that is free, is actually pretty good. I always recommend it .

Henry
 
salvin francis
Bartender
Posts: 1268
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian Janisch wrote:
Henry Wong wrote:http://java.sun.com/docs/books/tutorial/essential/exceptions/


let me guess, you googled 'java exceptions tutorial' and followed the first result ?


I find that a bit harsh, especially coming from a user who contributed nothing in this thread,



André Asantos,

basically there are 3 parts to it:




The code you would write in part1 is the code that might throw an exception.
The code you would write in part2 is the code that should run when an exception is "caught"
The code you would write in part3 is the code that should run regardless of an exception after the try block, This code executes even when an exception not caught by the catch block occurs.

You can write several catch blocks:



also finally can be excluded altogether,

for more information you can refer henry's link.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember you do not necessarily have to catch any Exception where it occurs; there will be more about that in the Java™ Tutorials link which Henry gave yesterday.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic