How Do We Get User Input in Java? - Full Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น • 59

  • @thaimilamonegabolander8338
    @thaimilamonegabolander8338 ปีที่แล้ว +2

    Thanx so much John! I'm on my third week for Java dev. Yesterday I cried in class, and yelled; I just don't understand anything! Today I'm back up on the horse. My teacher guided me to your chanel. XOXO thai

  • @ruantristancarlinsky3851
    @ruantristancarlinsky3851 2 ปีที่แล้ว +8

    You are so amazing, Please continue making more videos on Java. Will be greatly appreciated!

  • @aliyyahidk
    @aliyyahidk ปีที่แล้ว +1

    Super helpful and easy to understand!

  • @raphaelferrazza4412
    @raphaelferrazza4412 2 ปีที่แล้ว

    Im surprised so many people make videos or go on forums despite how wrong they are most of the time! its really amazing

  • @AlexKelly-mk8py
    @AlexKelly-mk8py 4 หลายเดือนก่อน

    Ty so much this helped me print some basic code.

  • @kristinaz7046
    @kristinaz7046 3 ปีที่แล้ว +1

    Cheese sanwidch is not garbage.
    Video is very helpful!

  • @ensarthewicked
    @ensarthewicked 9 หลายเดือนก่อน

    love you john, I really do

  • @higiniofuentes2551
    @higiniofuentes2551 10 หลายเดือนก่อน

    Thank you for this very useful video!

  • @ibnearabi3640
    @ibnearabi3640 2 ปีที่แล้ว

    Great explanation. Thank you.

  • @johnnyjohn6645
    @johnnyjohn6645 3 ปีที่แล้ว

    thanks a lot John !

  • @Nelfa183
    @Nelfa183 ปีที่แล้ว

    Wao you made it so simple . Thanks 🙌

  • @neverStopLearning3
    @neverStopLearning3 3 ปีที่แล้ว

    Great explanation, thanks

  • @szaronaangel7725
    @szaronaangel7725 2 ปีที่แล้ว

    It's a veeery good tutorial, thank you!

  • @yaya9164d
    @yaya9164d ปีที่แล้ว

    great job sir!

  • @jakesegal
    @jakesegal 3 ปีที่แล้ว

    Johns the best!

  • @tushartomar3586
    @tushartomar3586 2 ปีที่แล้ว

    buddy you're doing a great job , i really want to thankyou for this, could you plz make a video about oops but in advance way, but each of the four concept should be explained in the separate video

  • @chandulasamarasinghe3088
    @chandulasamarasinghe3088 ปีที่แล้ว

    love your videos

  • @Arfifias
    @Arfifias ปีที่แล้ว +1

    I would like smaller and easier tutorials like constructor tutorial you made that was pretty good

  • @Ahmadzai-15
    @Ahmadzai-15 2 ปีที่แล้ว

    Great method how to teach
    Respect from Afghanistan 🇦🇫…

  • @vaibhavhanegave256
    @vaibhavhanegave256 2 ปีที่แล้ว

    nice and helpfull thank you bro.

  • @theconsul8452
    @theconsul8452 2 ปีที่แล้ว +2

    At 6:36 , how did you delete the whole line so quickly without selecting the characters ? What is that keyboard shortcut ?

    • @CodingWithJohn
      @CodingWithJohn  2 ปีที่แล้ว +5

      Control + D, works in many programs. One of my most used shortcuts for sure!

  • @javidaghayarli8252
    @javidaghayarli8252 2 ปีที่แล้ว

    Thanks boss 👍

  • @vic17.
    @vic17. ปีที่แล้ว +1

    i have a question at around 11:05, I saw you assigned floatAge the value inside of the try block, but declared it outside of it. Is this necessary, or could you declare floatAge and initialize both inside of the try block?

    • @piikayy7511
      @piikayy7511 ปีที่แล้ว +2

      If you declare and initialize the floatAge variable inside of the try block you will only be able to use it inside(!) of the try block, as it only exists within that block.
      So if you are looking to, for example print out the value of floatAge later on (like John did in the video), you will have to declare and initialize it outside of the try block.

    • @vic17.
      @vic17. ปีที่แล้ว

      @@piikayy7511 oh ok that makes sense thank you

  • @SPXCVIII
    @SPXCVIII 3 ปีที่แล้ว

    Thank You

  • @harshvaviya1467
    @harshvaviya1467 5 หลายเดือนก่อน

    great video

  • @etipeti555
    @etipeti555 9 หลายเดือนก่อน

    In chapter 8 I was taught something called casting (not working with the scanner class). Are both what I mentioned and what you tought us equaly valid or is there a difference?

  • @dypsking3414
    @dypsking3414 2 ปีที่แล้ว

    Love all your videos...
    You're truly awesome 👍💪
    Please could you do a video on the different types of ways to get user inputs?
    Be keeping an eye out for this
    ✊✊

    • @saarza9991
      @saarza9991 10 หลายเดือนก่อน

      Scanner and BufferedReader

  • @kebroonabebayehu2559
    @kebroonabebayehu2559 2 ปีที่แล้ว

    You're awesome!

  • @Pacvalham
    @Pacvalham 2 ปีที่แล้ว

    I can't make a cheese sandwich into a float, but I can make ice cream into a float by pouring soda on it.

  • @unbelievable699
    @unbelievable699 4 ปีที่แล้ว +1

    thaanks alot

  • @thariqdeyis140
    @thariqdeyis140 ปีที่แล้ว

    How to make the scanner inputs are beside the question??

  • @anyahayes3601
    @anyahayes3601 2 ปีที่แล้ว

    Can you explain why you can’t reopen a Scanner after you call close?

  • @mhdmk8245
    @mhdmk8245 2 ปีที่แล้ว

    Ty sir

  • @ntphiep
    @ntphiep 3 ปีที่แล้ว

    Great video , but can I have a question ? Why my scanner nextFloat read float from keyboard with comma instead of dot ? , can you help me . Thanks

    • @Scofield9975
      @Scofield9975 2 ปีที่แล้ว +1

      Your scanner is high

    • @fandusmercius723
      @fandusmercius723 2 ปีที่แล้ว

      depends on your windows keyboard language probably

  • @richardschmid5699
    @richardschmid5699 3 วันที่ผ่านมา

    6:11 - Suitably creeped out

  • @Mrexecexec
    @Mrexecexec 2 ปีที่แล้ว

    Hi John. I have a strange issue. I expect code below to allow me to enter 3 string elements from keyboard but unfortunately after entering two strings, immediately I see the output of myStrings array which looks odd: [FirstString, ,SecondString]. There is an empty element between myStrings[0] and myStrings[2]? Why? It is expecting that each scanner.nextLine() will consume the new line including
    ; but the situation is not as such?
    import java.util.Arrays;
    import java.util.Scanner;
    public class Main {
    private static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args) {
    String[] myStrings = getStrings(3);
    System.out.println(Arrays.toString(myStrings));
    }
    public static String[] getStrings(int number){
    System.out.println("Enter "+number+" strings
    ");
    String[] values = new String[number];
    for (int i=0;i< values.length;i++){
    values[i]=scanner.nextLine();
    }
    return values;
    }
    }

    • @Mrexecexec
      @Mrexecexec 2 ปีที่แล้ว

      My real output is "C:\Program Files\Amazon Corretto\jdk11.0.15_9\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1.1\lib\idea_rt.jar=49409:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1.1\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\ARCHITECT\IdeaProjects\ArrayVsArrayList\out\production\ArrayVsArrayList Main
      Enter 3 strings.
      First
      Second
      [First, , Second]
      Process finished with exit code 0

    • @Mrexecexec
      @Mrexecexec 2 ปีที่แล้ว

      Another code peace which is odd too. The problem is with scanner.nextLine() but why?
      import java.util.Arrays;
      import java.util.Scanner;
      public class Main {
      private static Scanner scanner = new Scanner(System.in);
      public static void main(String[] args) {
      String[] myStrings = new String[3];
      myStrings[0]=scanner.nextLine();
      myStrings[1]=scanner.nextLine();
      myStrings[2]=scanner.nextLine();
      System.out.println("End entering. But problem is still there");
      System.out.println(Arrays.asList(myStrings));
      }
      }

  • @jeremyunger9806
    @jeremyunger9806 11 หลายเดือนก่อน

    So we're just ignoring his shoe size? (Great video)

  • @ndk8111
    @ndk8111 2 ปีที่แล้ว

    13:38. Is this bad practise to evaluate booleans as booleanName == false
    How about (!booleanName) in your example.

  • @inoobbeyt1031
    @inoobbeyt1031 ปีที่แล้ว

    What happened in while condition i didn't get

  • @Pacvalham
    @Pacvalham 2 ปีที่แล้ว +1

    I prefer a bang instead of "== false".

  • @hackcracker7691
    @hackcracker7691 2 ปีที่แล้ว

    Jhonny sins 😂😂 brother im joking

  • @murtajiz545
    @murtajiz545 2 ปีที่แล้ว

    Thanks for the video mate but are we gonna ignore this man having a size 14 foot? 💀

  • @bloomin1819
    @bloomin1819 2 ปีที่แล้ว

    With that shoe size, you ever play any basketball??

  • @kIllera911
    @kIllera911 2 ปีที่แล้ว

    Java is really verbose

  • @eternalflames911
    @eternalflames911 ปีที่แล้ว

    But i dont wanna be a good boy scout...im a girl