Java Tutorial: Getting User Input in Java

Java Tutorial: Getting User Input in Java

Introduction and Exercise

In this section, the speaker introduces an exercise and provides some notes for reference.

Quick Exercise

  • The speaker presents a quick exercise related to finding the sum of numbers.
  • The details of the exercise can be found in the video.
  • Notes, source code, and cheat sheets are available in the description or comment section.

Running the Program

This section focuses on running a program using IntelliJ IDEA.

Creating a New File

  • The speaker creates a new file named "CWH-05" in IntelliJ IDEA.
  • They prompt for user input by writing "Enter number 1".

Taking Input

  • The naming convention for files is explained (e.g., CWH-05).
  • User input is taken using the Scanner class.
  • A scanner object is created, and the main method is written.
  • System.out.print is used to display messages to the user.

Reading Data from Keyboard

  • The concept of reading data from the keyboard is introduced.
  • The Scanner class is mentioned as a tool for reading input from users.

Understanding Scanner Class

This section provides an explanation of what the Scanner class does.

Scanner Class

  • The purpose of the Scanner class is explained.
  • It allows reading input from users through various methods like nextInt() and nextFloat().

Timestamp repeats information already covered.

Introduction to Scanner Class

In this section, the speaker introduces the concept of using the Scanner class for input in Java programming.

Using the Scanner Class

  • The speaker explains that the submissions made by students are used as examples.
  • The answer written on the question paper is considered as an object.
  • The class acts as a template for writing code that takes input from the user.
  • The blank sheet represents a new instance of the class.
  • The scanner class is imported to take input from the user.

Creating Instances with Scanner Class

This section focuses on creating instances (objects) using the Scanner class and how to use them.

Creating Instances

  • An instance refers to a new object that can be used for input.
  • To create an instance, a new object is made using the scanner class.

Using Objects Created with Scanner Class

This section explains how to use objects created with the Scanner class for different types of inputs.

Using Objects

  • Different methods like nextLine, nextFloat, and next are used to read different types of inputs such as strings, floats, and characters.
  • Examples are given on how to use these methods effectively.

Taking Multiple Inputs with Scanner Class

This section demonstrates how to take multiple inputs using different methods of the Scanner class.

Taking Multiple Inputs

  • Multiple inputs can be taken by creating multiple instances of the scanner class.
  • Examples are provided on how to take multiple inputs for different data types such as strings and floats.

Creating Good Programs

In this section, the speaker discusses the process of creating good programs.

Writing Code for Scanning

  • The speaker explains the importance of writing code for scanning.
  • They mention using an up-beat and down-curve approach while writing code.
  • The speaker emphasizes the need to understand HP risk and object-oriented programming concepts.

Writing Answers in Examinations

  • The speaker talks about how to write answers in examinations.
  • They suggest following a specific format and structure while answering questions.
  • It is important to write answers similar to how one would write them in question papers.

Creating Personal Abstractions

  • The speaker encourages individuals to create their own personal abstractions.
  • They give an example of creating an abstraction for question number 1 in a subject called "Manlo Shoba."

Modifying Programs

  • The speaker discusses modifying programs by changing certain elements.
  • They mention using the next float method as an example of modification.

Personal Abstractions and Submissions

This section focuses on personal abstractions and submissions.

Creating Personal Abstractions

  • Individuals are encouraged to create their own personal abstractions.
  • Each person can have their unique set of personal abstractions.

Submission Methods

  • Different methods can be used for submitting work or assignments.

Modifying Programs with Next Float Method

This section covers modifying programs using the next float method.

Modifying Programs with Next Float Method

  • The speaker explains how to modify programs using the next float method.

VK

This section mentions VK.

Video description

Taking User input in Java Programming: In this video we will see how to get Input from User in Java Programming language. Scanner class is used to take user input in Java. Java scanner class has methods like nextInt, nextFloat etc which are used to take user input entered from the keyboard. We will see how to instantiate the scanner class object and create a program which is capable of taking user input. ►This playlist is a part of my Complete Java Course playlist: https://www.youtube.com/playlist?list=PLu0W_9lII9agS67Uits0UnJyrYiXhDS6q ►Source Code + Notes - https://archive.codewithharry.com/videos/java-tutorials-for-beginners-5 ►Ultimate Java CheatSheet: https://archive.codewithharry.com/videos/java-tutorials-for-beginners-1 ►Checkout my English channel here: https://www.youtube.com/ProgrammingWithHarry ►Click here to subscribe - https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww Best Hindi Videos For Learning Programming: ►Learn Python In One Video - https://www.youtube.com/watch?v=ihk_Xglr164 ►Python Complete Course In Hindi - https://www.youtube.com/playlist?list=PLu0W_9lII9agICnT8t4iYVSZ3eykIAOME ►C Language Complete Course In Hindi - https://www.youtube.com/playlist?list=PLu0W_9lII9aiXlHcLx-mDH1Qul38wD3aR&disable_polymer=true ►JavaScript Complete Course In Hindi - https://www.youtube.com/playlist?list=PLu0W_9lII9ajyk081To1Cbt2eI5913SsL ►Learn JavaScript in One Video - https://www.youtube.com/watch?v=onbBV0uFVpo ►Learn PHP In One Video - https://www.youtube.com/watch?v=xW7ro3lwaCI ►Django Complete Course In Hindi - https://www.youtube.com/playlist?list=PLu0W_9lII9ah7DDtYtflgwMwpT3xmjXY9 ►Machine Learning Using Python - https://www.youtube.com/playlist?list=PLu0W_9lII9ai6fAMHp-acBmJONT7Y4BSG ►Creating & Hosting A Website (Tech Blog) Using Python - https://www.youtube.com/playlist?list=PLu0W_9lII9agAiWp6Y41ueUKx1VcTRxmf ►Advanced Python Tutorials - https://www.youtube.com/playlist?list=PLu0W_9lII9aiJWQ7VhY712fuimEpQZYp4 ►Object Oriented Programming In Python - https://www.youtube.com/playlist?list=PLu0W_9lII9ahfRrhFcoB-4lpp9YaBmdCP ►Python Data Science and Big Data Tutorials - https://www.youtube.com/playlist?list=PLu0W_9lII9agK8pojo23OHiNz3Jm6VQCH Follow Me On Social Media ►Website (created using Flask) - http://www.codewithharry.com ►Facebook - https://www.facebook.com/CodeWithHarry ►Instagram - https://www.instagram.com/codewithharry/ ►Personal Facebook A/c - https://www.facebook.com/geekyharis Twitter - https://twitter.com/Haris_Is_Here