Read the OPs requirements. I answered his question without any comments.
You should explain to the OP about OOP and why using the main() for simple programs is a bad idea.
Type: Posts; User: Norm
Read the OPs requirements. I answered his question without any comments.
You should explain to the OP about OOP and why using the main() for simple programs is a bad idea.
Put all your code in the main() method. Then you only define the one class that main() is in.
Sure, it takes time to learn the new vocabulary and terms.
I'm afraid you'll have to use objects if you use the Scanner or String classes.
Think you are. Only if you code with primitives such as int and char can you NOT use objects.
Many of the variables in your code refer to objects of class such as String and Scanner.
What class are the readString() and readInt() methods members of?
What is the class of the object used with them?
Read the API doc to find the answers.
At the top of the API docs page there is...