Message from @Jacob
Discord ID: 500181952901545985
What's the error?
"The method compareTo(Object) is undefined for the type Object"
You're missing a (
where?
and why would that make the compareTo method undefined?
before sorted
second line
Doesn't look like it's closed
nah all the parentheses are closed
I changed it to the one Chris sent
I'm not getting any errors from parentheses
@Jacob `data` is an Object, how do you know it implements the Comparable interface?
```java
javac Tester.java
./CDoublyLinkedList.java:155: error: cannot find symbol
(sortedCurr.data.compareTo(curr.data) > 0)) {
^
symbol: method compareTo(Object)
location: variable data of type Object
1 error
```
is there a way I can make it implement comparable class?
I'm not sure how much I'm supposed to modify this assignment
or is there a better way to do insertion sort?
You can try to call the compareTo method and then catch an Exception if compareTo is not implemented
how do I do that?
I feel like there's a better way that I'm missing, since this is part of the assignment and I don't think he wants us to modify the given code
well, besides filling in the methods
maybe I could cast the object?
the tester class only uses characters
@Jacob Cast it as Comparable?
or maybe as a char
or integer if that's possible
I don't know
@Jacob
line 4
```java
private Object data; //Assume data implemented Comparable
```
OK... you can assume that, but Java is going to want that declared somewhere
or it will refuse to compile
I think he really may want you to try/catch
God
I did this stuff like two years ago
I got a Java developer certificate when I graduated high school
and we did try catch and everything
```java
try {
your code;
}
catch Exception {
//leave empty lol
}
```
we also did Linked Lists I think
put that inside the method?