Computer Science Canada BigInteger |
Author: | cool dude [ Sat Jun 17, 2006 10:19 am ] | ||
Post subject: | BigInteger | ||
i just learned BigInteger but i'm having a small problem.
it says that cannot resolve symbol method valueOf(java.math.BigInteger) on line 8 |
Author: | wtd [ Sat Jun 17, 2006 10:22 am ] |
Post subject: | |
The error is telling you there's no valueOf method that takes a BigInteger as an argument. |
Author: | cool dude [ Sat Jun 17, 2006 10:36 am ] |
Post subject: | |
wtd wrote: The error is telling you there's no valueOf method that takes a BigInteger as an argument.
wat does that mean? |
Author: | wtd [ Sat Jun 17, 2006 11:04 am ] |
Post subject: | |
Look at the BigInteger API docs. Tell me what kind of arguments valueOf can take. |
Author: | cool dude [ Sat Jun 17, 2006 2:26 pm ] |
Post subject: | |
wtd wrote: Look at the BigInteger API docs. Tell me what kind of arguments valueOf can take.
isn't it Integers. thats wat it looks like when i look on the internet. they plug in a number (integer) inside the brackets. am i right? |
Author: | wtd [ Sat Jun 17, 2006 2:30 pm ] | ||
Post subject: | |||
/me sighs
It takes a "long" value, not a BigInteger object. |
Author: | cool dude [ Sat Jun 17, 2006 2:39 pm ] |
Post subject: | |
ya i just figured it out a sec ago. i fixed it up, but i still have a question. if u did need a bigInteger value there instead of the long is there any way to have it? |
Author: | cool dude [ Sat Jun 17, 2006 2:45 pm ] |
Post subject: | |
oh and how do u convert from a BigInteger to String |
Author: | wtd [ Sat Jun 17, 2006 2:45 pm ] |
Post subject: | |
Look at the methods that are available for BigInteger objects. You really need to learn how to read the API docs. That skill will be the key to either sinking or swimming with Java. |
Author: | cool dude [ Sat Jun 17, 2006 3:31 pm ] | ||
Post subject: | |||
i figured it out, but now when i'm adding all the digits in the number up i'm getting an error and i have no idea why ![]()
|
Author: | wtd [ Sat Jun 17, 2006 3:36 pm ] |
Post subject: | |
Read the error message. Think about the problem. |
Author: | cool dude [ Sun Jun 18, 2006 10:27 am ] |
Post subject: | |
wtd wrote: Read the error message. Think about the problem.
they don't really give me an error message. usually when there's a problem i'm given an error message and shown the line number with the error. this time though it compiles and doesn't show any error message, but when i try to run it it doesn't run. |
Author: | wtd [ Sun Jun 18, 2006 10:31 am ] |
Post subject: | |
So it outputs nothing, you're saying? |
Author: | cool dude [ Sun Jun 18, 2006 10:40 am ] |
Post subject: | |
wtd wrote: So it outputs nothing, you're saying?
Not exactly. when i compile it, usually it tells me there is an error but it doesn't. when i run it it says something but i have no clue wat it means. |
Author: | wtd [ Sun Jun 18, 2006 10:55 am ] |
Post subject: | |
What does it say? (one step at a time...) |
Author: | cool dude [ Sun Jun 18, 2006 11:00 am ] |
Post subject: | |
it says: Quote: Exception in thread "main" java.lang.NumberFormatException: for input string: "" i do not understand this error and its obvious i don't understand it because otherwise i wouldn't be asking. |
Author: | wtd [ Sun Jun 18, 2006 11:06 am ] | ||
Post subject: | |||
Look at your program, then look at this error. See any words in the above that stand out? |
Author: | cool dude [ Sun Jun 18, 2006 11:19 am ] | ||
Post subject: | |||
wtd wrote:
Look at your program, then look at this error. See any words in the above that stand out? i think i'm blind ![]() |
Author: | [Gandalf] [ Sun Jun 18, 2006 12:46 pm ] |
Post subject: | |
Come on... "main", main(), do you see a similarity? That means the error must be in the main method, right? What else does the error message tell you? NumberFormatException - something about an exception relating to the format of a number. Next, "for input string: """, something about an empty string, right? So where in your program do you have stuff about strings and numbers? This is how you narrow the problem down... Keep trying. |