Java Tutorial – 11 – Validating User Input

///Java Tutorial – 11 – Validating User Input

Java Tutorial – 11 – Validating User Input

FavoriteLoadingAdd to favorites

In this Video I will be showing you how to validate user input, to avoid mis matching variables, and stop your programs from crashing.

Java468x60

Remember to follow me on Google+

If you are new to Java go check out the playlist for the series, and get caught up on everything you need to know about Java:

Just a reminder that my website is currently not available.

source

By |2020-11-22T10:41:12+00:00November 22nd, 2020|Java Video Tutorials|36 Comments

36 Comments

  1. Phoenix King November 22, 2020 at 10:41 am - Reply

    How can I do this with an object of a class?

  2. Kahari Tariro November 22, 2020 at 10:41 am - Reply

    Mine is throwing an InputMismatchException when I enter strings

  3. Ω‹ November 22, 2020 at 10:41 am - Reply

    Im so late to this but im new to java programming and I dont understand why you put "number = input.nextIt();" inside the if statement wouldn't it not run in the first place since its inside the if statement and the user hasn't even inputed anything yet?

  4. TV YOUTUBE November 22, 2020 at 10:41 am - Reply

    7 years ago😱😱😱😱😱

  5. 4 AM CLASSES November 22, 2020 at 10:41 am - Reply

    Good stuff budfy

  6. Saurabh Verma November 22, 2020 at 10:41 am - Reply

    How to cheack the every element of an array ,is integer or not

  7. Erik Castillo November 22, 2020 at 10:41 am - Reply

    pfft! This was perfect! You answered all the questions I had!!!! first video to do that for me. Thanks a million!!!

  8. Julian Lau November 22, 2020 at 10:41 am - Reply

    Its been years since you have uploaded this video, but its still helping people even now! Thanks :D.

  9. Wayne Brandon November 22, 2020 at 10:41 am - Reply

    Great little tutorial

  10. Aishwarya Matada November 22, 2020 at 10:41 am - Reply

    So, with the do while loop, I want to allow my user to enter wrong data only 5 times. That is, I want to throw an exception "I don't understand you" 5 times and after which I want to terminate and say "contact system admin" … How do I do this ?

  11. BeatMil November 22, 2020 at 10:41 am - Reply

    I thought this wouldn't help me since it's so old.
    but damn I was wrong.
    Thanks

  12. Jephthe Louis-Jacques November 22, 2020 at 10:41 am - Reply

    Thanks! This makes sense πŸ™πŸΎ

  13. Matteo Wise November 22, 2020 at 10:41 am - Reply

    you are Santa Claus !

  14. Andre Champoux November 22, 2020 at 10:41 am - Reply

    I'd appreciate some help. I have a webForm, but I want to use human validation. I want them to verify the day of the month (2 digits). Here is the code with no validation.
    <?php

    $SendFormTo = '[~Hypno@HypnosisHelp.ca~]';

    $EmailSubject = '[~Hypnosis Help Contact Form~]';

    $Name = $_POST['Name'];

    $City = $_POST['City'];

    $Phone = $_POST['Phone'];

    $Email = $_POST['Email'];

    $Country = $_POST['Country'];

    $Comments = $_POST['Comments'];

    $body = "

  15. Matthew Zvirbulis November 22, 2020 at 10:41 am - Reply

    haha why did i just not watch the video, ive been trying to debug this infinite loop for days and driving me crazy ….thanks for the vid!

  16. Adrian Blue November 22, 2020 at 10:41 am - Reply

    I am extremely grateful for this tutorial and all your other tutorials. I got stuck in a problem and my program was in an infinite loop. Thanks to you I was able to break the loop and validate user input. πŸ˜­πŸ˜πŸ‘ŒπŸ‘

  17. Ashfaque Ahmad November 22, 2020 at 10:41 am - Reply

    Noceee video sir

  18. TheZooman22 November 22, 2020 at 10:41 am - Reply

    Amazing! I am taking a college class in Java . I feel like I have learned more from you, in one video, than I have from my Professor.

  19. LUCKY KAREEM November 22, 2020 at 10:41 am - Reply

    Create an applet to accept an integer as parameter and display a message as "Are you years old?" The age is to be displayed in the blank space. The default age is 30

  20. Akshayaa Shrestha November 22, 2020 at 10:41 am - Reply

    Thanks! πŸ™‚

  21. TMONT November 22, 2020 at 10:41 am - Reply

    Have a question. I have successfully validated if user input is an int, but how do I also validate if user input is in range of 1-10 or whatever numbers i choose?

  22. Ali P. Aiyoubi November 22, 2020 at 10:41 am - Reply

    i dont understand … how does it goes in if condition ? i mean hasNextInt we havent enetered anything there is nothing before if statement

  23. drew bombs November 22, 2020 at 10:41 am - Reply

    WHAT IF YOU WANT TO ADD A RANG OF SAY 3-5

  24. Chris Jenkins November 22, 2020 at 10:41 am - Reply

    Dude im learning more from you than I am from the school im paying beaucoup bucks

  25. phanith nou November 22, 2020 at 10:41 am - Reply

    Helpful

  26. Sufiyan Mirza November 22, 2020 at 10:41 am - Reply

    If you type "I dont know" with spaces in between the words when prompted for input in the terminal, It displays "I dont understand you" 3 times instead of one. Can you please help me how to solve this issue.

  27. Zain BEN SALEH November 22, 2020 at 10:41 am - Reply

    Simple and important , nice work

  28. OSVALDO SALMERON November 22, 2020 at 10:41 am - Reply

    I need help withΒ Validate User Input Using Java Chars and Strings

  29. OSVALDO SALMERON November 22, 2020 at 10:41 am - Reply

    do you have an email ?

  30. Uhype Gaming November 22, 2020 at 10:41 am - Reply

    Can someone help me out with thisone?:

    import java.util.Scanner;

    public class Program
    {
    public static void main(String[] args) {
    System.out.println("Frage");
    Scanner F1 = new Scanner(System.in);
    String F1G = F1.nextLine();
    String F1F = "Wrong answer";
    if (F1G = "Vraag"){
    System.out.println("Das ist gut");
    }
    else{
    System.out.println("Das ist falsch");
    }
    }
    }

  31. mohammed badran November 22, 2020 at 10:41 am - Reply

    Thank you from Egypt

  32. Hack Zall November 22, 2020 at 10:41 am - Reply

    Great video, this video taught me more than my 3 hour java class…

  33. Ahsan Farooq November 22, 2020 at 10:41 am - Reply

    I don't understand why the while loops works when (isNumber == false). Shouldn't it say print number while the user entered a number (isNumber == true)?

  34. B Aviles November 22, 2020 at 10:41 am - Reply

    how would you do it with an arraylist.

  35. andy molar November 22, 2020 at 10:41 am - Reply

    YOU GOOD, only if you will oblige me the opportunity to connect with you, i will be the most human being on earth.

  36. Kenneth beteryel November 22, 2020 at 10:41 am - Reply

    Write a program to encrypt the line entered by the user. Encryption is performed
    by replacing all occurrences of the letter β€˜i’ by β€˜e', all occurrences of the letter β€˜e’
    by the letter β€˜a’, and all occurrences of the letter β€˜a’ by the letter β€˜i’. For example,
    if the user enters the line: The ear is big. Then the output from the program is: Tha
    air es beg. Both upper case and lower case of aforementioned letters must be
    encrypted

Leave A Comment

*