Programming and Problem Solving with Java

(やまだぃちぅ) #1

742


{

if(first <= last)
{ // Recursive case
outFile.println(data[last]+ " ");
print(data, first, last - 1 );
}
// Empty else clause is the base case
}
9.public static intpower(intx, intn)
// Returns x raised to the power n
// Assumption: x is a valid integer and n is greater
// than or equal to 0
// Note: Large exponents may result in integer overflow
{
if(n == 0 )
return 1 ; // Base case
else
returnx * power(x, n - 1 ); // Recursive call
}

Chapter 14 Exam Preparation Exercises
1.An applet doesn’t have a mainmethod. An applet is not invoked in the same fash-
ion as an application. Applets are subjected to more security constraints than an
application because they are distributed over the Web. Applets are not in control
of their own execution.
4.Appletclass
6.The addmethod is not applied to a pane object in the case of an applet.
9.The applet must be run within a Web browser or an applet viewer. The browser
recognizes a link to a Bytecode file, and the JVM within the browser executes the
code.
12.A tag is the syntactic element in a markup language that indicates how informa-
tion should be displayed.
15.The Internet is a wide area network that spans the planet, while the Web is an in-
frastructure of information and the network software used to access it. Thus the
Internet is the hardware and the Web makes it usable by providing the
appropriate software.
17.A LAN is a local area network of nodes in a close geographic area. A WAN is a net-
work made up of two or more other networks.
Free download pdf