Quiz4.fa09

Quiz4.fa09 - What method does this object need to provide...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Signature _____________________ CSE 11 Name ________________________ Quiz 4 cs11f ____ Fall 2009 Student ID ____________________ This quiz is to be taken by yourself with closed books, closed notes, no calculators. What is the output produced by the following program? (Hint: draw stack frames) public class Mystery { public static void main( String[] args ) { Mystery ref = new Mystery(); System.out.println( ref.mystery( 7 ) ); } private int mystery( int a ) { int b = a + 3; if ( b >= 8 ) { System.out.println( b ); b = a + mystery( a - 1 ); System.out.println( a ); } else { System.out.println( "Whoa!" ); b = a; System.out.println( a ); } return b; } } Output
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
We have done a couple GUI programming assignments. What interface does an event handler need to implement to listen for and handle events on a JButton (button) in Java? _______________________
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: What method does this object need to provide to satisfy this interface and handle the event fired by a button? public void ____________________________ ( __________________________ evt ) { . .. } Given the following expressions, indicate whether the expressions evaluate to true or false. String s1 = new String( "CSE 11" ); String s2 = "CSE 11"; s1 == s2 __________ s1.equals( s2 ) __________ s2 = s1; s1 == s2 __________ s1.equals( s2 ) __________ Given the following array declaration: int a = { 1, 3, 5, 7, 9 }; Fill in the blanks to print out each element: ___________ ( int i = ___________ ; i < ___________ ; ___________ ) System.out.println( ___________ );...
View Full Document

This note was uploaded on 01/07/2011 for the course CSE CSE11 taught by Professor Cs during the Spring '10 term at UCSD.

Page1 / 2

Quiz4.fa09 - What method does this object need to provide...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online