Here in bar here in foo cis120 spring 2012 abstract

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ce. Then, pop saved workspace frames off the stack, looking for the most recently pushed one that contains a try/catch block whose catch clause declares a supertype of the excepAon being thrown. If no matching catch is found, abort the program with an error. CIS120 / Spring 2012 _;! System.out.println(
 “here in foo”);! this! Exception! _;! catch (Exception e) { System.out.Println (“caught”); } ! System.out.println(
 “here in bar”);! _;! 
 Abstract Stack Machine Workspace Stack Heap _;! C! this! Discard the current workspace. Then, pop saved workspace frames off the stack, looking for the most recently pushed one that contains a try/catch block whose catch clause declares a supertype of the excepAon being thrown. If no matching catch is found, abort the program with an error. CIS120 / Spring 2012 _;! System.out.println(
 “here in foo”);! Exception! this! _;! catch (Exception e) { System.out.Println (“caught”); } ! System.out.println(
 “here in bar”);! _;! 
 Try/Catch for ( )? No! Abstract Stack Machine Workspace Stack _;! Heap C! this! When a matching catch block is found, add a new binding to the stack for the excepAon variable declared in the catch. Then replace the workspace with catch body and the rest of the saved workspace. ConAnue execuAng as usual. CIS120 / Spring 2012 _;! System.out.println(
 “here in foo”);! Exception! this! _;! catch (Exception e) { System.out.Println (“caught”); } ! System.out.println(
 “here in bar”);! 
 Try/Catch for ( )? Yes! Abstract Stack Machine Workspace { System.out.Println (“caught”); } ! System.out.println(
 “here in bar”);! Stack 
 When a matching catch block is found, add a new binding to the stack for the excepAon variable declared in the catch. Then replace the workspace with catch body and the rest of the saved workspace. ConAnue execuAng as usual. CIS120 / Spring 2012 _;! Heap C! this! _;! System.out.println(
 “here in foo”);! this! e! Exception! Abstract Stack Machine Workspace { System.out.Println (“caught”); } ! System.out.println(
 “here in bar”);! ConAnue execuAng as usual. 
 Stack _;! C! this! _;! System.out.println(
 “here in foo”);! this! e! CIS...
View Full Document

Ask a homework question - tutors are online