DOC PREVIEW
UD CISC 181 - CISC181 Final Review

This preview shows page 1-2-3-4-5-6-7-8-9-10-73-74-75-76-77-78-79-80-81-82-83-147-148-149-150-151-152-153-154-155-156 out of 156 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 156 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Fall, 2011CISC181 Final ReviewProf. Christopher RasmussenCourse page: http://goo.gl/jJ8HTAdministrative details I● Deadline for course evaluations: Thursday, Dec. 8, midnight● Written comments are most helpful...Administrative details II● Preliminary grades posted on course page● Vincent should have sent each of you a random "ID code" to look yourself up...Administrative details III● You have one extra day to finish Project #3: the due date is now Wednesday, December 7 (at midnight)● You can still use late days after that if you have them● Don't forget Lab #8 -- due at the usual time for your section this weekFinal Details● Next Thursday, December 15● Closed book, no notes, no calculators, cell phones, etc.● Worth 15% of your grade (same as midterm)● Covers all lectures from Tuesday, October 25 through Tuesday, November 29 class○ Pay close attention to exact pages in readings○ Topics in the textbook: Assertions/exceptions, Swing○ Topics totally outside the textbook: Unit testing, Android○ Will NOT cover anything about Eclipse or its built-in debugging facilities (including Android logging)○ STUDY SAMPLE PROGRAMS WE WENT OVER IN CLASS! ● Question types ○ Language, API feature/concept definitions and explanations○ Write a function that does X or a whole class with certain variables and methods○ If we call method f() with arguments a and b, what does it return/print/do?Topics Covered● Exception handling, assertions● Unit testing (separate slides #1)● Deployment○ JARs (separate slides #2)○ Applets: no main(), derive your class from JApple, put set-up code in init() ● Swing (separate slides #3)○ Windows, button/mouse events, listeners○ 2-D drawing ○ Layout managers, swapping panels○ Timers, animation● Android○ Activities: concepts, starting, communicating between○ Views, resources, layouts○ 2-D graphics, animation○ Storing preferences, reading text file○ Sound, text-to-speech, vibration, accelerometertry-throw-catch Mechanism● A throw statement is similar to a method call: throw new ExceptionClassName(SomeString);○ In the above example, the object of class ExceptionClassName is created using a string as its argument○ This object, which is an argument to the throw operator, is the exception object thrown● Instead of calling a method, a throw statement calls a catch block9-6Copyright © 2010 Pearson Addison-Wesley. All rights reserved.Defining Exception Classes● A throw statement can throw an exception object of any exception class● Instead of using a predefined class, exception classes can be programmer-defined○ These can be tailored to carry the precise kinds of information needed in the catch block○ A different type of exception can be defined to identify each different exceptional situation9-17Copyright © 2010 Pearson Addison-Wesley. All rights reserved.Multiple catch Blocks● A try block can potentially throw any number of exception values, and they can be of differing types○ In any one execution of a try block, at most one exception can be thrown (since a throw statement ends the execution of the try block)○ However, different types of exception values can be thrown on different executions of the try block9-25Copyright © 2010 Pearson Addison-Wesley. All rights reserved.Multiple catch Blocks● Each catch block can only catch values of the exception class type given in the catch block heading ● Different types of exceptions can be caught by placing more than one catch block after a try block○ Any number of catch blocks can be included, but they must be placed in the correct order9-26Copyright © 2010 Pearson Addison-Wesley. All rights reserved.Pitfall: Catch the More Specific Exception First● When catching multiple exceptions, the order of the catch blocks is important○ When an exception is thrown in a try block, the catch blocks are examined in order○ The first one that matches the type of the exception thrown is the one that is executed9-27Copyright © 2010 Pearson Addison-Wesley. All rights reserved.The finally Block● The finally block contains code to be executed whether or not an exception is thrown in a try block○ If it is used, a finally block is placed after a try block and its following catch blocks try { . . . } catch(ExceptionClass1 e) { . . . } . . . catch(ExceptionClassN e) { . . . } finally { CodeToBeExecutedInAllCases }9-46Copyright © 2010 Pearson Addison-Wesley. All rights reserved.The finally Block● If the try-catch-finally blocks are inside a method definition, there are three possibilities when the code is run:1. The try block runs to the end, no exception is thrown, and the finally block is executed2. An exception is thrown in the try block, caught in one of the catch blocks, and the finally block is executed3. An exception is thrown in the try block, there is no matching catch block in the method, the finally block is executed, and then the method invocation ends and the exception object is thrown to the enclosing method9-47Copyright © 2010 Pearson Addison-Wesley. All rights reserved.The Catch or Declare Rule● Most ordinary exceptions that might be thrown within a method must be accounted for in one of two ways:1. The code that can throw an exception is placed within a try block, and the possible exception is caught in a catch block within the same method2. The possible exception can be declared at the start of the method definition by placing the exception class name in a throws clause 9-32Copyright © 2010 Pearson Addison-Wesley. All rights reserved.When to Use Exceptions● Exceptions should be reserved for situations where a method encounters an unusual or unexpected case that cannot be handled easily in some other way● When exception handling must be used, here are some basic guidelines:○ Include throw statements and list the exception classes in a throws clause within a method definition○ Place the try and catch blocks in a different method9-40Copyright © 2010 Pearson Addison-Wesley. All rights reserved.Assertion Checks● An assertion is a sentence that says (asserts) something about the state of a program○ An assertion must be either true or false, and should be true if a program is working properly○ Assertions can be placed in a program as comments● Java has a statement that can check if an assertion is true assert Boolean_Expression;○ If assertion checking is turned on and the Boolean_Expression evaluates to false, the


View Full Document
Download CISC181 Final Review
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CISC181 Final Review and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CISC181 Final Review 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?