1. What are the diagrams defined in the UML Standard. Give a one or two sentence description of each one.
2. Given the following code, how should the toString methods in the classes H2ClassA and H2ClassB be written to give the indicated output and take advantage of the natural toString method in H2ClassB?
3. How can the following code be corrected? Give at least two good answers.
4. Why does the following code give a compiler error? How should it be fixed?
5. What is wrong with the following declaration? How should it be fixed? public static final int myNumber = 17.36;
6. What is wrong with the following code? How should it be fixed?
7. What is wrong with the following code? How should it be fixed?
8. What is wrong with the following code? x should be given a value of 24. What are two ways this can be legally accomplished?
9. What is wrong with the following code? Give two effective ways to fix it.
10. Why does the following code give a compiler warning? How should it be fixed?
11. Pick an interface in the JDK and describe a good use of it. Java 8 stuff - I will probably be adding to this as we go along since 8 has so many new features.
Also, I think you will find some of my thoughts and examples of interfaces helpful:
12. Choose one among the options below:
13. The scope rules of modern programming languages are rooted in rules developed by the earliest block structured languages like Algol. Adding object orientation to languages adds one more layer of complexity to this issue.
Let's consider Java, a language with which everyone should be familiar, and explore its scope rules. One aspect of the scope rules of any language is when data or methods can have the same name. Give examples in Java to illustrate a case where declaring two local variables with the same name in same method is permitted and one where it is prohibited. Are the rules governing redeclaration of local names the same as those governing redeclaring local names that rename class-level names?
One consequence of scope rules in most languages is that forward references (referring to names before they are declared) are prohibited. Are such forward references always prohibited within a single Java class? Are forward references of local names always prohibited within a single method? If not, provide an example that demonstrates your claim.