When you do things right, people won't be sure you've done anything at all.
Janeice DelVecchio wrote:The number one problem here is it's giving me a compiler error based on the fact that the "operator < cannot be applied to String". I read that Strings ARE comparable....
Janeice DelVecchio wrote:
The Collections.sort(studentList) is giving me a warning during compile.... something about it being unchecked.
Janeice DelVecchio wrote:
The declaration for the Student class is also warning me that Student is not abstract (not sure what this means).
Janeice DelVecchio wrote:
The number one problem here is it's giving me a compiler error based on the fact that the "operator < cannot be applied to String". I read that Strings ARE comparable....
Mike Simmons wrote:
Your other issues are all related to generics. Some of them are ignorable, at least in the short term. But the message about Student not being abstract, look closely - exactly what method does it say hasn't been implemented? And how is that different from the method you have implemented?
When you do things right, people won't be sure you've done anything at all.
Janeice wrote:I thought by putting in my own compareTo() it WAS overriding it...... just sayin'.
When you do things right, people won't be sure you've done anything at all.
When you do things right, people won't be sure you've done anything at all.
Henry Wong wrote:[EDIT: Beaten by 40 seconds... ]
Janeice DelVecchio wrote:We'll call it a tie.....
Janeice DelVecchio wrote: I checked out the HF and the generics section was included in the sorting section. Big Java? They're separated by over 100 pages. Perfect.
Janeice DelVecchio wrote:The actual error (and I thought it was a warning... hah!) is as follows:
Student.java - Student is not abstract and does not override abstract method CompareTo in java.lang.Comparable.
Janeice DelVecchio wrote: I don't understand all this <E> and <T> business...... much less do I see how this applies.
I don't think I WANT to use a generic class because I want an ArrayList of STUDENTS not WHATEVERS.
When you do things right, people won't be sure you've done anything at all.
Doesn't that take care of making sure it's a list of STUDENTS? I mean if I forget in an accepting method to put that <Student> in the bracket it comes up with that asinine warning.... like I'm gonna put a Dog in a list of Students.....
I STILL don't get why the <Student> now has to go in the declaration of the implementation of Comparable. Isn't that why I made the compareTo() method? So it knows I'm comparing lastNames of Students and not collarColors of Dogs?
When you do things right, people won't be sure you've done anything at all.
When you do things right, people won't be sure you've done anything at all.
Janeice DelVecchio wrote:I just need to remember to let the asinine compiler know there won't be Dogs in my Students. I mean, it's only looking out for me, right?
SCJP, OCMJD
When you do things right, people won't be sure you've done anything at all.
Now run that and see what outputs you get. Note particularly what happens to the two Marias with different ages.campbell@queeg:~/java$ java Person Campbell 96 Janiece 21 Carlos 21 Maria 23 Maria 42 Esteban 17 Rob 57
When you do things right, people won't be sure you've done anything at all.
When you do things right, people won't be sure you've done anything at all.
There is a risk of incorrect data if you store the same information in two places; if one changes you must change the other. I would have suggestedJaneice DelVecchio wrote: . . . the wholeName is a function of lastName and firstName.....
The evaluator was impressed with the student's apparent skill in Java coding fundamentals, use of Scanner class for input, array construction and manipulation, file output, command line menu design, and error-trapping. The quality of commenting is also commendable and documents all major functional blocks. This program shows a great effort in Java and the student is encouraged to keep up the great work!
When you do things right, people won't be sure you've done anything at all.
See where your hand is? Not there. It's next to this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|