
In the previous lecture, we discussed a Piazza-like system with classes Post and Response. What is the relationship between these classes?
Which of the following diagrams correctly describes the relationship between the given classes?



Consider this code snippet:
Scanner in = new Scanner(new FileReader("input.txt"));
while (in.hasNextLine())
{
String line = in.nextLine();
System.out.println(line);
}
What is wrong about this sequence diagram?

read on the file reader.
lab2 subdirectory of your personal repo, the other submits a file report.txt in the lab2 subdirectory of your repo.cd ~/cs151 mkdir lab4You will later put UML diagram files inside.
Question, Answer, User and FollowupDiscussion. Just draw relationship arrows. Pay attention to the multiplicities. Take a photo when you are done. Question and Answer. Are they exactly identical? Do they have something in common? Can you come up with class from which both inherit?ArrayList<String> list = ...
Iterator<String>> iter = list.iterator();
while (iterator.hasNext())
{
String element = iterator.next();
System.out.println(element);
}
Draw a sequence diagram with an unnamed object representing this code, and objects list and iter. Now the fun begins. Look at the implementation of ArrayList. The definitition of iterator is in line 818. Draw what it says. (Hint: create)next. From where to where does it go? When you look at the Itr.hasNext method in line 830, you see it doesn't do anything else.next—line 834. It calls another method. Draw it! (You can peek inside that method in line 884. It doesn't call other methods.)iter? Is it the correct type? Fix it if not.