Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 4 Weeks Ago   #1 (permalink)
Overclocker in Training
 
rmvvwls's Avatar
 
intel ati

Join Date: Aug 2008
Location: NSW, Australia
Posts: 530

Rep: 57 rmvvwls is acknowledged by some
Unique Rep: 46
Trader Rating: 1
Default Java typecasting error

Okay, I have a Java program that's supposed to build a concordance, and it's throwing a weird error.
Quote:
cannot find symbol
symbol: method addLine(int)
location: interface java.lang.Comparable
The line returning this looks like:
Code:
letters[listLocation].returnNode(entry).addLine(numLines);
Letters is an array holding custom written Binary Search Tree (BST) objects, typecast to hold custom written Word objects. addLine is a method in Word, but it can't seem to find it.

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
Any ideas?

System: Bradsbomp
CPU
Intel e7200 2.53GHz @ 3.8GHz (400 x 9.5, 1.36V)
Motherboard
Gigabyte GA-EP45-UD3P
Memory
4 GB OCZ 800MHz (4-4-4-12)
Graphics Card
Sapphire 4870x2
Hard Drive
WD320+Samsung 160&500
Sound Card
Onboard
Power Supply
Corsair TX650W
Case
Thermaltake Armor+ MX w/ Custom Paintjob
CPU cooling
Zalman CNPS9700LED
GPU cooling
Stock
OS
Windows 7 RC (7100)
Monitor
TH32LZD800A + E2200HD
rmvvwls is offline rmvvwls's Gallery   Reply With Quote
Old 4 Weeks Ago   #2 (permalink)
With great difficulty
 
rabidgnome229's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: Pittsburgh
Posts: 5,210

Rep: 614 rabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famous
Unique Rep: 370
FAQs Submitted: 6
Trader Rating: 5
Default

What is the definitions of Word.addLine?
__________________
System: It goes to eleven
CPU
E6300
Motherboard
DS3
Memory
2GB XMS2 DDR2-800
Graphics Card
EVGA 8600GTS
Hard Drive
1.294 TB
Sound Card
Audigy 2 ZS
Power Supply
Corsair 520HX
Case
Lian-Li v1000B Plus
CPU cooling
TTBT
GPU cooling
Thermalright V2
OS
Arch Linux/XP
Monitor
Samsung 226bw
rabidgnome229 is offline Overclocked Account   Reply With Quote
Old 4 Weeks Ago   #3 (permalink)
Overclocker in Training
 
rmvvwls's Avatar
 
intel ati

Join Date: Aug 2008
Location: NSW, Australia
Posts: 530

Rep: 57 rmvvwls is acknowledged by some
Unique Rep: 46
Trader Rating: 1
Default

Code:
//adds a line number to a word
        public void addLine(int line){
            lines.add(line);
        }
I believe now it may have something to do with the method returnNode.
Working on it now.

System: Bradsbomp
CPU
Intel e7200 2.53GHz @ 3.8GHz (400 x 9.5, 1.36V)
Motherboard
Gigabyte GA-EP45-UD3P
Memory
4 GB OCZ 800MHz (4-4-4-12)
Graphics Card
Sapphire 4870x2
Hard Drive
WD320+Samsung 160&500
Sound Card
Onboard
Power Supply
Corsair TX650W
Case
Thermaltake Armor+ MX w/ Custom Paintjob
CPU cooling
Zalman CNPS9700LED
GPU cooling
Stock
OS
Windows 7 RC (7100)
Monitor
TH32LZD800A + E2200HD
rmvvwls is offline rmvvwls's Gallery   Reply With Quote
Old 4 Weeks Ago   #4 (permalink)
With great difficulty
 
rabidgnome229's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: Pittsburgh
Posts: 5,210

Rep: 614 rabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famous
Unique Rep: 370
FAQs Submitted: 6
Trader Rating: 5
Default

From the error message it looks like returnNode returns a Comparable rather than a Word
__________________
System: It goes to eleven
CPU
E6300
Motherboard
DS3
Memory
2GB XMS2 DDR2-800
Graphics Card
EVGA 8600GTS
Hard Drive
1.294 TB
Sound Card
Audigy 2 ZS
Power Supply
Corsair 520HX
Case
Lian-Li v1000B Plus
CPU cooling
TTBT
GPU cooling
Thermalright V2
OS
Arch Linux/XP
Monitor
Samsung 226bw
rabidgnome229 is offline Overclocked Account   Reply With Quote
Old 3 Weeks Ago   #5 (permalink)
Overclocker in Training
 
rmvvwls's Avatar
 
intel ati

Join Date: Aug 2008
Location: NSW, Australia
Posts: 530

Rep: 57 rmvvwls is acknowledged by some
Unique Rep: 46
Trader Rating: 1
Default

Quote:
Originally Posted by rabidgnome229 View Post
From the error message it looks like returnNode returns a Comparable rather than a Word
That's what was confusing me. I didn't understand at the time how it COULD return a comparable, seeing as comparable is an interface, not an object.
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);
and typecasting it that way worked. Extra line, but I can deal with that.
Thankyou for taking the time to help nevertheless. rep+

System: Bradsbomp
CPU
Intel e7200 2.53GHz @ 3.8GHz (400 x 9.5, 1.36V)
Motherboard
Gigabyte GA-EP45-UD3P
Memory
4 GB OCZ 800MHz (4-4-4-12)
Graphics Card
Sapphire 4870x2
Hard Drive
WD320+Samsung 160&500
Sound Card
Onboard
Power Supply
Corsair TX650W
Case
Thermaltake Armor+ MX w/ Custom Paintjob
CPU cooling
Zalman CNPS9700LED
GPU cooling
Stock
OS
Windows 7 RC (7100)
Monitor
TH32LZD800A + E2200HD

Last edited by rmvvwls : 3 Weeks Ago at 11:09 PM
rmvvwls is offline rmvvwls's Gallery   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 06:10 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.13576 seconds with 8 queries