• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Java Code

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was wondering if you can take alook at this code fix the following errors for me.

";' expected - line 109,120,133,156

not a statement - line 167,178,

illegal start of expression - line 144,199

reached end of file while parsing - line 199



     






 
Saloon Keeper
Posts: 13268
292
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Few people are willing to copy the code to an editor and compile it to find out what lines the error messages are referring to. The least you can do is post the full error message including the line number.

When posting code, please enclose it in code tags like [code]this[/code].
 
Pete Pliastos
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hopefully this helps a little bit and know includes the code lines of where I am getting the error messages

";' expected - line 109,120,133,156

not a statement - line 167,178,

illegal start of expression - line 144,199

reached end of file while parsing - line 199
 
Marshal
Posts: 74020
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct the first error you found. No, you haven't found the first error; I did. Then see how many errors you have afterwards. Line 108 looks very iffy to me. You will have to make those corrections yourself; we don't write other people's code.
 
Master Rancher
Posts: 4028
53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that the line numbers we see here are different from the numbers that you're seeing in your file.  I'm guessing you didn't copy all the lines from your program into your post, so the line numbers are different.  So, when people mention line number here, you'll have to look at the line numbers in your post to figure out which line they mean.

You seem to have written a lot of code before you started looking at the error messages.  It's a lot easier if you write a little bit at a time, compile and run as you go, to see if what you're doing is being understood by the compiler.  That way you can learn from a given mistake before you repeat it five more times.

Capitalization matters, in programming.  If you look at an example program that says "public void main" and you change it to "Public Void main", it won't work.  Was this copied and pasted from a word processor?  They often change capitalization in ways that make no sense for programming.

There are also multiple places where you've inserted a ; where none should be.  Or omitted a ().
 
Rancher
Posts: 1043
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is very fishy:



Try something like this instead: - also note the capitalization (or the lack thereof):

 
Campbell Ritchie
Marshal
Posts: 74020
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apart from the capitalisation, what is the difference? I don't like variable names like inAge; plain simple age would be so much better. I am also not convinced that all the setXXX() and getXXX() methods so many people are taught to use are actually a good thing.
 
Mike Simmons
Master Rancher
Posts: 4028
53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Apart from the capitalisation, what is the difference?



Not to disagree with your other points, but you seem to have missed other vital differences.  The original code had an extra ; and no parameter list; it was effectively a field declaration followed by an initializer block, when it was presumably intended to be a method declaration.
 
Campbell Ritchie
Marshal
Posts: 74020
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you are right. I missed those points.
 
I'm full of tinier men! And a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic