Forums Register Login

End of file while parsing

+Pie Number of slices to send: Send

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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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 )
+Pie Number of slices to send: Send
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!
1
+Pie Number of slices to send: Send
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

(1 cow) 4
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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:


+Pie Number of slices to send: Send
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).
+Pie Number of slices to send: Send
 

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
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 4857 times.
Similar Threads
Q on variable Initialization
this(i)
equals versus ==
Constructor question
variable scope
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:15:44.