Lab 6 –
Fall 2008 Possible Points: 100 Points Earned: _____
Name _________________________
3.4
What output was generated?
Ï «Ï ----jGRASP exec: java Example1 |
3.8
What output was generated?
Ï «Ï ----jGRASP exec: java Example1 |
3.9 You might be surprised that Example1
executed given that it uses Constants.FALL which is no longer defined. Why did it execute?
because the executable was based on original
Constants.java - you didn't recompile |
3.11 What error was generated?
Ï «Ï ----jGRASP exec: javac
E:\2008-CS239\Lab6\Example1.java |
3.16 What output was generated?
«Ï ----jGRASP exec: java Example1 |
3.17 What is wrong with this output and
what caused the problem?
it doesn't show the starting month
for Summer. The problem was caused because in
example 1 the output goes from SPRING to FALL and SUMMER comes after FALL in
Constants.java |
3.21 What output was generated?
«Ï ----jGRASP exec: java Example1 |
3.22 What is wrong with this output and
what caused the problem?
It shows SUMMER and FALL starting in
August. SemesterUtilities says if the month isn't SPRING it's August. |
3.24 Will this version of Example1.java
compile?
yes -
because the argument to startingMonth is a valid integer |
3.25 What output would be generated by this
statement?
Ï«Ï ----jGRASP exec: java Example1 |
3.26 Why is this somewhat troubling?
because August isn't the 7th
month |
3.27 What output would be generated by the
statement
System.out.println(Constants.SPRING);
Ï0 |
3.28 What output would be more informative
for the previous statement?
The ordinal value for SPRING is 0 |
4.3
What output was generated?
Ï«Ï ----jGRASP exec: java Example2 |
4.5
What code did you add to the
main() method in Example2.java?
(Copy and paste it here.)
if (second.compareTo(first) > 0) |
4.8
What output was generated?
Ï «Ï ----jGRASP exec: java Example2 |
4.9 What
is wrong with this output and why?
It says that B- is a better grade
than B- and in the real world this isn't true |
4.10 How does a "B" compare to a
"B-" at JMU and in Java?
B- is better than B in
Java, B is better than B- at JMU |
5.3
What output was generated?
Ï«Ï ----jGRASP exec: java Example3 |
5.4
What determines the order used by the compareTo() method?
The ASCII (or Unicode) collating
sequence OR The
order in which the enum values were listed (collating sequence) |
5.5
What .class files were generated?
Example3$LetterGrade.class Example3.class
|
5.9
What .class files were generated?
LetterGrade.class Example3.class
|
5.11 What output was generated?
Ï«Ï ----jGRASP exec: java Example3 |
5.12 JMU has instituted a grade of "D-". What changes do you need to make to
LetterGrade.java?
insert DMINUS between F, and D |