Jose Perez1,183 Points
throwing exception is not fully understood? Please help.
I dont really understand how does the throw new System.Exception in the constructor in the MapLocation class interact with the catch when trying to create the Maplocation object.
What happens if there is no catch wont the throw exception in the constructor throw the exception that it MapLocation object being created is not on the map? Can someone please explain so I can better understand.
Steven Parker111,463 Points
When the exception is thrown, it causes the code in the "catch" block to start running. It doesn't matter that the "throw" happened in a different module.
If there is no "try" and "catch", then a "throw" will cause the entire program to stop and the system will print out an error message.