| CIT 591 Midterm Exam, Fall 2007 | Name ______________________________ |
private? new
Color(__, __, __) constructor? static? class Foo { int x = 3; int y = 5; static
int z = 7; }Foo objects. How many ints have
been created?
Foo class that
takes one int parameter, and returns a Foo whose x value
equals twice the given parameter.maxCoordinate for the above Foo class
that returns the larger of the two values x and y.names is an array of Strings. Write a loop to print
out the contents of this array, one String per line. assert statement? That
is, when should you use it? sudoku. public static void main(String[ ] args) :
public Available from
anywhere static Belongs to the
class itself, not to individual objects void Does not return a value main The name of the
method String[ ] The single
formal parameter is an array of Strings args The name of the
formal parameter int syntaxErrors(int input)
{ // Must declare the type of the parameter private int
count = 0; // Local variables cannot
be private
do {
int maximum
= 100; // Declaration here is okay but causes
error below
input = 2 * input;
count++;
} while (input <= maximum); //
maximum is out of scope; declaration is in loop
return count;
}
10 and print the result.static Says it belongs
to the class, not to individual objects this The
object that is executing the current code void Specifies that
a method does not return a value break Exits from a
loop or a switch statement continue Goes
to the next iteration of the enclosing loopclass Person {
String name;
Person(String name) { }
} System.out.println(myFriend.spouse.getBirthday());import it?