I would like to make so that when you have a int and prompting user to enter some number for calculations... if the number entered is larger than a 10digits, my program wouldn't just crash or if the user enters a string... I havn't be taught any error catching stuff yet but it would be good to have my simple command line program to run without crashing...
Thanks.
rugae
0
Light Poster
Recommended Answers
Jump to Postusing try and catch is an easy, but on the other hand definitive way to catch your error. your program will not crash, but if you make a wrong input, your program won't ask for any more.
for instance:
int numbers[] = new int[5];
try{ for(int …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.