In future, while posting code, please UseCodeTags I have added them this time for you. As you can see the tags make the code much more easier to read and understand.
Also, you seem to have missed out on the braces (hopefully while posting) Please edit your post and correct them.
Posting a bunch of code and saying "
i have dificulties with private, static, public instance variables.
" does not really help us help you. Do you have any specific questions?
Aside from the static members and making your members private, your code is structured well. It's hard to see what exactly you need to understand, because, as far as I see, this code looks like someone who had a good understanding of modularizing their code.
I spent about 2 seconds looking at your code, and would say that it definitely does NOT make sense.
Because there are ZERO comments. Comments may seem like a waste of time at this stage, but trust me, they are vital in every single piece of code you write. Even if it is nothing more than a general statement of what the class/method is for, it needs to be there.
Next, a variable name like "junk" is not very well named. if it holds junk, then why bother saving it at all? a more descriptive name like "userInput" is MUCH better and tells me immediately what it is for, rather than making me hunt through the code.
I personally would put in some validation code. If you ask the user to input a value between 1 and 25, you should validate that they did. There are a lot of evil users who will read that direction, and say "I wonder what happens if I put in 87?".
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Nov 11, 2012
Well Thank you all for your help. i will try to look in youtube to find out how to define and call classes. that is what i have more difficulties.
Joined: Oct 13, 2005
Suryanarayana murthy welcome to the Ranch
Joined: Oct 13, 2005
Alain Fallada wrote: . . . i will try to look in youtube to find out . . .
Careful. some of the things you find might be not at all helpful.