|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Java typecasting error
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||||||||||||||
|
Overclocker in Training
![]() |
Okay, I have a Java program that's supposed to build a concordance, and it's throwing a weird error.
Quote:
Code:
letters[listLocation].returnNode(entry).addLine(numLines); Letters is declared as such: Code:
BST[] letters = new BST[26]; //create the array of letters
for (int i=0; i<26; i++){ //create one for each letter
letters[i] = new BST();
}//end for
__________________
|
||||||||||||||
|
|
|
|
|
#2 (permalink) | |||||||||||||
|
With great difficulty
![]() |
What is the definitions of Word.addLine?
__________________
|
|||||||||||||
|
|
|
|
#3 (permalink) | |||||||||||||
|
Overclocker in Training
![]() |
Code:
//adds a line number to a word
public void addLine(int line){
lines.add(line);
}
Working on it now.
__________________
|
|||||||||||||
|
|
|
|
|
#4 (permalink) | |||||||||||||
|
With great difficulty
![]() |
From the error message it looks like returnNode returns a Comparable rather than a Word
__________________
|
|||||||||||||
|
|
|
|
#5 (permalink) | ||||||||||||||
|
Overclocker in Training
![]() |
Quote:
But for some reason it was returning a generic object, and describing it as comparable. Changing it to Code:
Word toModify = (Word)letters[listLocation].returnNodeContents(entry); toModify.addLine(numLines); Thankyou for taking the time to help nevertheless. rep+
__________________
Last edited by rmvvwls : 3 Weeks Ago at 11:09 PM |
||||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|