# Topic G – Raising Exceptions
# Overview
This topic introduces the throw statement and exceptions. The following new keywords are introduced.
- throw
- throws
This topic will demonstrate objects that are capable of validating information supplied to them. This introduces the principle in object oriented design that well designed objects are capable of ensuring the validity of their internal state. When invalid information is supplied, either through the constructor or through other methods, objects can respond by raising exceptions.
# LOGs
# General Programming Concepts and Terms
- Describe how object-oriented programs run
- Describe what is meant by a "call stack"
- Define the term "Exception"
- Describe what is meant by the phrase "raising (or throwing) an exception"
- Describe the role that exceptions play in a computer program
- Identify the three most commonly used Exception types used in this course
# OOP Basics
- Explain why methods (including constructors) should perform validation of their parameter values
- Explain the significance of raising an exception in the constructor
- Use exceptions as part of the validation of parameter values in methods and constructors
- Explain why property setters are a good place for throwing exceptions
- Identify when constructors should throw exceptions directly
Examples →