1/32
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
exception
an event that occurs during the execution of a program that encounters an error or some kind of exceptional situation
when do exceptions happen?
at runtime
exceptions should be _______ instead of _______
handled, avoided
when an exception occurs, two things happen (1)
an exception object is created and thrown
when an exception occurs, two things happen (2)
the normal flow of control is disrupted
stack trace
tells the user which methods were active when the program crashed
propogated
when the exception object is thrown/passed back to its calling method
try block
code that can thrown an exception
catch block
code for how you want to deal with the exception
unchecked exceptions
do not have to be caught; compiler will not generate an error message, but if there is a problem the program will crash at runtime
unchecked exceptions (ex:)
ArithmeticException, NullPointerException, NumberFormatException, StringIndexOutOfBoundsExceptionh
checked exception
must be caught or explicity propagated to the calling method; an error message at compile time
java.lang.RuntimeException
ensures an unchecked exception
throw keyword
is used to explicitly throw an exception
throws keyword
used to indicate that a method might throw a checked exception and propagate it
role of the interface
to define the set of behaviors (methods) that all of the implementing classes must contain
what is the goal of the interface?
to define the methods that each class must contain
contract
the interface is the _______ that each implementing class must follow
implementing classes
combining the interface with regular classes that provide implementations for the abstract methods
implements keyword
used by a class to implement an interface
inheritance
a way to create a new class based on an existing class without the need to manually copy-paste the source code
parent class, super class, base class
the original class you want to extend
child class, subclass, derived class
the new class you want to create based on the parent class
class hierarchy
a collection of classes related by inheritance
extends keyword
is used in the same class declaration of a child class to set up the inheritance relationship
java.lang.Object
superclass of all other classes
super keyword
how a child constructor can call the parent’s constructor on the first line of the child constructor
abstract methods
a non static (instance) method without an implementation (body)
constants
variables that are declared using the final keyword
-
private
~
package private
#
protected
+
public