Review Sheet for Exam 3
This sheet is intended to help you prepare for exam 3. I do not promise
you that it is complete. The exam will cover everything we've studied
1. Re-work the review sheets for the first two exams.
2. Write Java code that creates an array list of Integers. The integers
that should go in the list are on the command line. Iterate through the
array list and compute the sum of all the values in the list.
3. Describe one situation in which an array list would be more efficient than a linked list.
4. Each line in the file definitions.txt contains a word, followed by a
hyphen, and then the word's definition. Put all the words in the file
in a set. Discuss why you chose the concrete Set class that you used.
5. Take the definitions.txt file in #4, and put the words and
definitions in a Map. Print out all the words, and then separately
print out all the definitions.
6. Pick one method in Map.Entry and describe how it works. Give a few lines of code in which you call this method.
7. What is the default layout for the content pane of a JFrame object? Describe how this layout works.
8. Write a few lines of code that: create a JFrame with a title, make a
panel that contains 2 buttons, and add the buttons to the panel and the
panel to the frame. Handle button clicks so that the last clicked
button says "on" and the other one says "off". Initially one button
should be labeled "on" and the other "off".
9. Write a few lines of code in which you are using an anonymous class.