Java - User Input Validation and Exception Handling

Опубликовано: 16 Октябрь 2024
на канале: MoosesValley
5,682
57

This video demonstrates the best way to perform user input validation and exception handling, examines Java's Exception Class Hierarchy and Exception handling strategy, and answers the following questions:
* How do I validate user inputs ?
* Where should the code to validate inputs go ? In the GUI class ? In the data class ? Why ?
* Should errors be displayed in a Message dialog, in a Label, in the Console window, and/or somewhere else ?
* What about Exception Handling ?
* What are the advantages of using Exception Handling ? Why bother ?
* What is the best way to handle Exceptions ?
* Should I "use" an existing Exception class ?
* How do I create my own Exceptions ?
* Which part of the Exception hierarchy should my Exceptions extend ?
* How do I make it all work ?

Note: further improvements can be made, but this video shows enough for this "simple" GUI / data example. :)

The videos in this LinkedLists series:
* Java - LinkedLists - Students GUI - Add, Delete, Display - Part 01
   • Java - LinkedLists - Students GUI - A...  
* Java - User Input Validation and Exception Handling
   • Java - User Input Validation and Exce...  
* Java - LinkedLists - Students GUI - Add, Delete, Display - Part 02 - Edit
   • Java - LinkedLists - Students GUI - A...  
* Java - LinkedLists - Students GUI - Add, Delete, Display - Part 03 - NetBeans
   • Java - LinkedLists - Students GUI - A...  

Java Source code is in my GitHub:
* https://github.com/MooseValley/Linked...

If you'd like to learn more about Linked Lists, please see my 2 part special where I start with the very basics and build a linked list from scratch:
* LinkedList - From Scratch - Part 1 of 2:
   • LinkedList - From Scratch - Part 1 of 2  
* LinkedList - From Scratch - Part 2 of 2:
   • LinkedList - From Scratch - Part 2 of 2  

Moose's Software Valley - Established July, 1996.
https://rebrand.ly/MoosesSoftware