300 Methods Chapter 6 showStatus method of JApplet (Web site traffic)

300 Methods Chapter 6 showStatus method of JApplet startmethod of JApplet signature static storage duration simulation stop method of JApplet software engineering update method of JApplet software reusability void SELF-REVIEW EXERCISES 6.1 Fill in the blanks in each of the following statements: a) Program modules in Java are called and . b) A method is invoked with a . c) A variable known only within the method in which it is defined is called a . d) The statement in a called method can be used to pass the value of an expres sion back to the calling method. e) The keyword indicates that a method does not return a value. f) The of an identifier is the portion of the program in which the identifier can be used. g) The three ways to return control from a called method to a caller are , and . h) The method is invoked once when an applet begins execution. i) The method produces random numbers. j) The method is invoked each time the user of a browser revisits the HTML page on which an applet resides. k) The method is invoked to draw on an applet. l) Variables declared in a block or in a method s parameter list are of duration. m) The method invokes the applet s update method, which in turn invokes the applet s paintmethod. n) The method is invoked for an applet each time the user of a browser leaves an HTML page on which the applet resides. o) A method that calls itself either directly or indirectly is a method. p) A recursive method typically has two components: one that provides a means for the re cursion to terminate by testing for a case and one that expresses the problem as a recursive call for a slightly simpler problem than does the original call. q) In Java, it is possible to have various methods with the same name that each operate on different types and/or numbers of arguments. This feature is called method . r) The qualifier is used to declare read-only variables. 6.2 For the following program, state the scope (either class scope or block scope) of each of the following elements: a) the variable x. b) the variable y. c) the method cube. d) the method paint. e) the variable yPos. 1 public class CubeTest extends JApplet { 2 int x; 4 public void paint( Graphics g ) 5 { 6 int yPos = 25; Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/3/01

Leave a Reply