|
![]() |
Also too much code for the main method. All that code should be in other methods. Use the split method of the String class to separate the input.Paweł Baczyński wrote:. . .
Well, that is too much code.
. . .
All things are lawful, but not all things are profitable.
Also too much code for the main method. All that code should be in other methods. Use the split method of the String class to separate the input.
Please tell us which line throws this exception.
Can you post a stack trace?
Lenise Edwards wrote:For my Java class we are using JGrasp IDE and it didn't pinpoint the exact line that is causing the exception. Also, what is a stack trace and how do I perform one?
Yes. Or more likely several classesLenise Edwards wrote:Thank you all for the constructive criticisms . . .
When you say its too much code in the main method are you suggesting to create a class and create all the methods
Which book?. . . I was following the format the textbook used.
I am afraid it is not easy to read. It takes a lot of practice. Look here. Try "\\s+" which means any number greater than 0 of whitespace characters, as the “regex”.. . . Also I haven't covered anything on the split method yet but I can try and see if I can figure out how to use it from java API. I do find the API a bit difficult to learn
Have you suffered an Exception in your program? If so, you will have seen a stack trace. If not, try this program:-Once you get that running, you will see a stack trace caused by division by zero. I think the first line with the name of the Exception may not constitute part of the stack trace.. . . Also, what is a stack trace and how do I perform one? . . .
Paweł Baczyński wrote:
Lenise Edwards wrote:For my Java class we are using JGrasp IDE and it didn't pinpoint the exact line that is causing the exception. Also, what is a stack trace and how do I perform one?
When there is an uncaught exception, a stack trace is printed to the console. A stack trace shows you what method were called at which lines and wchich line caused the exception.
For example, running this code:
printsHere, a static method main() called a constructor (listed as <init>) at line 17, the constructor called foo() at line 5, foo() called baz() at line 8, baz() called bar() at line 11 and finally bar() threw an exception at line 14.
Have you suffered an Exception in your program?Campbell Ritchie wrote: .
Why is the word "abbreviation" so long? And this ad is so short?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|