Java Reference
In-Depth Information
public int k(int n)
{
if (n < 0)
{
int k = Ċn;
int n = (int) (Math.sqrt(k));
return n;
}
else return n;
}
public int m(int k)
{
int a;
for (int n = 1; n <= k; n++)
a = a + n;
for (int n = k; n >= 1; n++)
a = a + n;
return a;
}
private int n;
}
΢ Exercise R8.29. What is a qualified name? What is an unqualified name?
΢΢ Exercise R8.30. When you access an unqualified name in a method, what
does that access mean? Discuss both instance and static features.
΢΢ Exercise R8.31. Every Java program can be rewritten to avoid import
statements. Explain how, and rewrite RectangleComponent.java
from Chapter 2 to avoid import statements.
΢ Exercise R8.32. What is the default package? Have you used it before this
chapter in your programming?
΢΢T Exercise R8.33. What does JUnit do when a test method throws an
exception? Try it out and report your findings.
Additional review exercises are available in WileyPLUS.
380
Search WWH ::




Custom Search