5. Using the Scanner Class in Java (Simplified Version)

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
7,677
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jun 28, 2009

Watch in HD for better viewing.

Learn to take information from the user and use the information in your programming.

Code:

class TakeInformation {

public static void main(String args[]) {

Scanner myScanner = new Scanner(System.in);
String input;

System.out.println("Please enter your name...");
input = myScanner.nextLine();

System.out.println("Your name is: " + input);

}

}

Please check out my other vids for more tutorials. Also, please leave comments with any suggestions.
Subscribe, comment, rate.

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (25)

Sign In or Sign Up now to post a comment!
  • @oHKCOLEo Well I'm actually learning java at the moment, and making videos to help reinforce the information. But yeah, I have a lot of free time so I upload them and I'll answer any questions you have about it that I can answer!

  • @NetbeansTutorials wow. example fail, i already got it .

  • @NetbeansTutorials hey man, are you going to make tutorials continuously, or just stop after like 6, like all the rest of the lazy youtubers? :P

    if you are ill sub+watch :D

  • @2yung4grey The answer, with netbeans, would be:

    public class Howtouseasscanner { public static void main(String[] args) { Scanner sc = new Scanner( System.in );  System.out.println("What is your name?"); System.out.print("input, please =>"); String dateOfBirth = sc.nextLine(); System.out.println("Hello, your date of birth is " +dateOfBirth+ ". Welcome to Scanners!");

  • @oHKCOLEo

    When you create a project, you create three folders that house data and resources for your netbeans class files. The project contains your package, the package contains media, class files, and such, and then your source code has references to where it's housing data can be found, which you've just listed. They are your package Newproject and public class Newproject.

  • you should continue your job XD cause not many people doing tutorials for textpad Thanks alot ;)

  • Well said, great job. Helped with a little review before my next Java class. :)

  • Thanks for the tutorial :)

  • when i started my project on netbeans it had this on it "public class NewProject" and "package newproject;"

    what are these 2 lines? whats the public for inpublic class?

  • why u use  static void and etc? we dont use this..we are in the first 6 mounth

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more