Exception handling (programming): Difference between revisions

Content deleted Content added
Restored revision 1292259528 by TonySt (talk): Rv mention of obscure language
Syntax: Java syntax is sufficiently readable in English
Line 54:
In its whole, exception handling code might look like this (in [[Java (programming language)|Java]]-like [[pseudocode]]):
 
<syntaxhighlight lang="CSharpJava">
try {
lineScanner stdin = console.readLinenew Scanner();
String line = stdin.nextLine();
 
if (line.length() == 0) {
Line 62 ⟶ 63:
}
 
consoleSystem.printLineout.printf("Hello %s!\n" %, line);
consoleSystem.printLineout.println("The programtask ranexecuted successfully.");
}
} catch (EmptyLineException e) {
consoleSystem.printLineout.println("Hello!");
} catch (Exception e) {
}
System.out.printf("Error: %s\n", e.getMessage());
catch (Exception e) {
} finally {
console.printLine("Error: " + e.message());
}
else {
console.printLine("The program ran successfully.");
}
finally {
console.printLine("The program is now terminating.");
}