filmov
tv
Java Programming: Lesson 45 - Printing Formatted Strings

Показать описание
PLEASE SUBSCRIBE!!!
Exceptions allow you to divert program code if it is susceptible to throwing an error. I provide a lot of descriptions, notes, and static methods for studying, practicing, and working with exceptions in the previous video.
organic exceptions: naturally thrown in Java when you write code that is prone to an error
engineered exceptions: thrown in Java when you manually command that it throw an exception
handled exceptions: prevented in Java by using try-catch architecture to handle "dangerous" code
You can pass in a String when you throw an exception to throw a particular error message
try
{
//safe line
//dangerousCodeThatMightThrowAnException
//onlyMakesItHereIfTheDangerousCodeRanSuccessfully
}
catch( SpecificException s )
{
//runsIfTheSpecificErrorAppliesInTheTryBlock
}
catch( Exception w )
{
//runsIfAnErrorOtherThanSpecificExceptionAboveWasCaughtInTheTryBlock
}
finally
{
//runsRegardlessEvenIfAnExceptionOrRuntimeErrorIsThrown
}
You cannot put a superclass of Exception before a more particular subclass of Exception. (In other words, you cannot handle a specific type of error after you're already handling a more general type of error that would already catch the specific type.)
1:13 Review of Exceptions
There are a couple of videos regarding the printing of formatted strings in Python:
(Ended up geeking out and doing many more lessons, so happy birthday. You're welcome.)
Thanks for watching, and PLEASE SUBSCRIBE!!!
Exceptions allow you to divert program code if it is susceptible to throwing an error. I provide a lot of descriptions, notes, and static methods for studying, practicing, and working with exceptions in the previous video.
organic exceptions: naturally thrown in Java when you write code that is prone to an error
engineered exceptions: thrown in Java when you manually command that it throw an exception
handled exceptions: prevented in Java by using try-catch architecture to handle "dangerous" code
You can pass in a String when you throw an exception to throw a particular error message
try
{
//safe line
//dangerousCodeThatMightThrowAnException
//onlyMakesItHereIfTheDangerousCodeRanSuccessfully
}
catch( SpecificException s )
{
//runsIfTheSpecificErrorAppliesInTheTryBlock
}
catch( Exception w )
{
//runsIfAnErrorOtherThanSpecificExceptionAboveWasCaughtInTheTryBlock
}
finally
{
//runsRegardlessEvenIfAnExceptionOrRuntimeErrorIsThrown
}
You cannot put a superclass of Exception before a more particular subclass of Exception. (In other words, you cannot handle a specific type of error after you're already handling a more general type of error that would already catch the specific type.)
1:13 Review of Exceptions
There are a couple of videos regarding the printing of formatted strings in Python:
(Ended up geeking out and doing many more lessons, so happy birthday. You're welcome.)
Thanks for watching, and PLEASE SUBSCRIBE!!!