| CIT 590 Final Exam | Name ______________________________ |
Write only the code requested. Where I ask for a statement, give me a statement, not a complete method. Where I ask for a method, give me a method, not a class. Don't print results unless I ask you to. And so forth.
sum to be the sum of the numbers in the array
int[ ] scores.
Person p = new Person("John Smith");Person
class to handle this statement.
names to be an
ArrayList of Strings.
FileReader reader = new FileReader("foo.txt");FileNotFoundException. Put this statement in a
try statement, and print a stack trace if the exception occurs.
countParameters that takes any number of
int parameters, and returns how many parameters
it was called with.
quitButton is a JButton.
Use an anonymous inner class to attach a listener to quitButton
that will end the program when the button is clicked.
Season is defined as enum Season { WINTER, SPRING, SUMMER, FALL }season is a variable of type Season.
Write the shortest possible statement to print out the value
of season.
Sprite class extends
Thread.frog of type
Sprite.
frog Thread
to begin execution.
frog Thread is started.
public static average(double d1, double d2)Arithmetic, is supposed to return the average
of its two parameters. Write a JUnit 4 test method to make sure that it returns
the correct average of 2.3 and 2.7.
Keep all answers brief and to the point. Do not include information that was not asked for--it may cost you points. You may be penalized for excesssively verbose answers.
100 << 2100 >> 20xFF & 0x2A0xFF | 0x2A10 % 3 == 2 ? 'a' : 17(, should normally
be preceded by a space. State one exception to this
rule.
T) or false (F).
Serializable interface doesn't declare any methods.
@author tag is used for classes, interfaces, and methods.
Object by your own classes
should normally be overridden. Give the complete signature of two
such methods, and for each, tell why overriding it is a good idea.
private. Why?