Homework

  1. Why does the equals method of the String class take an Object as an argument rather than a String?
  2. Why are there separate classes for IO with byte streams and character streams?
  3. What is the difference between using an int array of size 1 from using an Integer object in a frequency list?
    array style:frequencies.put(“the”, new int[] { 123 });
    Integer style:frequencies.put(“the”, new Integer(123));
    In class, I said the difference I'm looking for is a performance difference. As an added hint, there are two performance differences between these two approaches. One difference is major and one is minor. If you tell me about either one, I'll be satisfied. As another hint, it's nearly impossible to come up with the minor performance difference just by thinking about it; I read it in a book a long time ago. If you're really stuck, code your program using each each to do it. The major performance difference should be evident in your code.
  4. The following question is for those who did not attend Thursday's class and couldn't participate in the group coding activity.
    Why are windows in Java (Frame, JFrame) invisible when constructed?
  5. The fifth homework question was replaced with a regular expression in-class assignment, and a subset of that assignment for people who didn't make it to class that day.
  6. Why should you use the event dispatch thread to update GUI components, but not for CPU-hungry tasks?
  7. Part one:
    What is one advantage of using XML?
    Part two (look up on the Internet):
    What is a SYN flood attack?
  8. Make a webpage using a text editor and post it on the web. Send an email to trnka@udel.edu with the URL of your webpage in the body of the email, and have the subject line be “Java homework webpage” (If you need HTML help, Google for “HTML tutorials” or something)
  9. In certain situations, a servlet is more appropriate than a JSP, and vice versa. Briefly describe the situation in which each is more appropriate than the other.