• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

End of file while parsing

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dear all, am a newbie to this enthralling world of java.
The other day when i was trying putting in my head into the norms of inheritance, i found that a subclass object was unable to invoke a the constructor for the base class. and when i tried sorting the same by putting in a constructor for the subclass and then invoking it by the subclass object i came across this "end of file while parsing problem".
I am pretty sure that something is wrong.... perhaps with my understanding!! could someone help me over this.

Regards
Subhashish
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What could that be ? Forgot to close a statement or a class ? It's difficult to say without seeing your code, without knowing when it happens (at compile time ?), where (console, IDE?), and what the exact error message is.
 
Subhashish Pattnaik
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanks Verre for having taken the time to reply back to the post.

This is the program which should give you a better insight of all the happenings.




Hope this program should be quite familiar to you.
I need your help in sorting this out which shows me "end of file while parsing" every time i compile it. I am executing these programs in the concsole mode.

Regards
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Please UseCodeTags when you post source code (I added them this time for you - I'm a moderator so I can edit your post).

About your problem: You forgot a closing } around line 56.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Give your class a name starting with a capital letter
2. You need at least one public class, the one with the main method
3. You need to close class boxwt (closing bracket missing)
4. You need to format your code clearly. This will help you spot unclosed brackets

And next time that you want to post some code, please UseCodeTags. (and welcome to the ranch )
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Those sneaky } jerks! I assume because of this error it means you are learning without a fancy schmancy IDE like Eclipse or Netbeans. Learning java with a more simple text-editor can be great for developing your mind to see errors in code and can be very beneficial if you end up going for certification, so keep up the good work! Oh yeah...I almost forgot... Welcome to the Ranch Subhashish!
 
Subhashish Pattnaik
Greenhorn
Posts: 14
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh am extremely sorry for not having put the indentations and made the use of "UseCodeTags" . Will keep that in mind,the next time i trouble u.

And many thanks to you guys in person (Jesper,Verre and Bob)!!
Obliged to you for having got such a prompt reply inspite of your busy schedule.

I will better go through the snippets of "As to how to post questions", the next time i bug you!!

All smiles

 
Marshal
Posts: 79178
377
  • Likes 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

You shouldn't write code the way you think You should write code. Most people think you write code like this . . . but you shouldn't That is how you would write a letter, but that method makes it easy to get your {} paired incorrectly. Write it like thisThat way you will always have the {} in pairs. Make sure to indent them correctly; MS NotePad is no used for that; try NotePad2 or NotePad++ or jEdit, which support bracket highlighting, automatic indentation, etc.
 
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch

You shouldn't write code the way you think you should write code. (cut..)



There is another cool way:just taking the habit to press the <enter> button anytime you type a "{"

the respective curl bracket } will be automatically set up, and the cursor will be like this:


 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't write such long comments; they make the post harder to read. And don't call comments annotations. Your method of pushing enter will only work if you use an IDE; my technique will work on a decent text editor (preferably with automatic indentation enabled).
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Don't write such long comments; they make the post harder to read. And don't call comments annotations. Your method of pushing enter will only work if you use an IDE; my technique will work on a decent text editor (preferably with automatic indentation enabled).


OK, point taken, make sense for people that have to read the post, I have to tame my narcisism:) and respect everyone time. Also I have to write more slowly without doing grammar mistakes and typos. thank you for the feedback
 
I'm full of tinier men! And a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic