bab 14

29 Jun

1. Define exception, exception handler, raising an exception, disabling an exception,
continuation, finalization, and built-in exception.

exception: any unusual event, erroneous or not, that is detectable by either hardware or
software and that may require special processing.

The special processing that may be required when an exception is detected
is called exception handling. This processing is done by a code unit or segment
called an exception handler. An exception is raised when its associated
event occurs.

After an exception handler executes, either control can transfer
to somewhere in the program outside of the handler code or
program execution can simply terminate. We term this the question
of control continuation after handler execution, or simply
continuation.

In some situations, it is necessary to complete some computation
regardless of how subprogram execution terminates. The ability to specify such
a computation is called finalization.

built-in exception : the name explain pretty much. it’s an exception, and it’s built-in.
built-in in the language.

2. What are the two alternatives for designing continuation?
first, it can catch the exception and throw
an exception that is listed in its own throws clause.
second, it could declare
the exception in its own throws clause and not handle it, which effectively
propagates the exception to an enclosing try clause, if there is one, or to the
method’s caller, if there is no enclosing try clause.

3. What are the advantages of having support for exception handling built
in to a language?
-time efficient
-less error

8. Where does execution continue after an exception is handled in Ada?
memory

27. Can you disable a Java exception?
yes.

28. What is the purpose of the Java finally clause?
to end an continuation

29. What advantage do language-defined assertions have over simple ifwrite
constructs?
time efficient & less error prone

32. What is event-driven programming?
a programming paradigm in which the flow of the program is determined by events

33. What is the purpose of a Java JFrame?
34. What is the purpose of a Java JPanel?
1. JPanel serves as a general purpose container,
while JFrame is a window commonly used for stand-alone
applications, like a warning window, or a notification window.

2. JPanel represents an area used for more complex operations or applications.

3. In JPanel, one panel can hold many operations,
while in JFrame, it can have inner frames for a different purpose.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: