Console
Counting alligators...
1 alligator
2 alligator
3 alligator
Counting sheep...
1 Blackie
2 Blackie
1 Dolly
2 Dolly
3 Dolly
1 Blackie
Operation
Specifications
void incrementCount()
void resetCount()
int getCount()
String getCountString()
public static void count(Countable c, int maxCount)
Which of the following statements is not true?
A. All the methods in an interface are abstract.
B. A class can implement just the methods of an interface it needs.
C. An interface can contain static constants.
D. A class can implement multiple interfaces.
E. A class can inherit another class and implement an interface.
A method that accepts an interface as an argument can accept any object that:
A. implements that interface
B. defines the same methods as the interface
C. implements the interface or defines the same methods as the interface
D. is created from that interface
A variable that stores an object that implements an interface can be declared as which of the following data types?
A. The class that defines the object
B. The interface that the object implements
C. Any subclass of the class that defines the object
D. All of the above
E. a and c only
When you code a class that implements an interface, NetBeans can:
A. throw an UnsupportedOperationException
B. generate the declaration for the inteface
C. generate all of the method declarations for the methods defined by the interface
D. generate the constants of the interface
The Cloneable interface:
A. clones an object
B. can only be used with mutable objects
C. indicates if an object can be cloned
D. indicates if an object has been cloned
The Comparable interface:
A. compares two objects
B. indicates if two objects have the same type
C. indicates if an object has overridden the equals method of the Object class
D. indicates if an object has overridden the toString method of the Object class
How does a mutable object differ from an immutable object?
A. A mutable object can be changed, and an immutable object can't be changed.
B. A mutable object can be cloned, and an immutable object can't be cloned.
C. A mutable object can be compared with other objects, and an immutable object can't be compared with other objects.
To include a class in a package, you:
A. code an import statement as the first statement of the class
B. code a package statement as the first statement in the class file
C. code the name of the package in the class declaration
Which of the following is not true about generated Java documentation?
A. It indicates the package that a class belongs to.
B. It lists all public methods of the class.
C. It includes the code that implements each documented method.
D. It lets you view classes by package.
Which of the following is an advantage of coding two or more classes in the same file?
A. You have fewer java files to manage.
B. You have fewer class files to manage.
C. It's easier to find the source code for a class.
D. It makes it easier to reuse a class.