Join Peggy Fisher for an in-depth discussion in this video Solution: Hello world, part of Java Essential Training for Students.
- So how did you make out?…I hope you are able to compile and run your program…from the command line.…It's pretty cool, right?…Let's take a look at my solution.…Remember that your solution might be very different.…All programmers program a little bit differently.…We'll start with the code.…At the very top I had to remember…to import my Java.util.scanner.…Line two is where I can declare my class, name and age.…Line three I have my public static void main,…then I read in the value that the user entered…as the command line argument…into the variable called prompt.…
I use that value to print…that back out to the screen.…I know the users going to type in a string and an integer.…So I create a string for the name…and an integer for the age.…On line nine I create my new scanner object.…Scanner in = new Scanner (System.in).…Then I read in the name = in.nextLine…and I read in the age = in.nextInt.…I don't have to parse it since this is not coming…from the command line prompt.…This is actually inside the running program…and then I print out whatever the user entered.…
- Getting started with parsing
- Reviewing data types
- Using decisions
- Creating user-defined methods
- Command-line debugging
- Exploring the Java API
- Creating and instantiating classes
- Working with interfaces
- Storing items with arrays
Skill Level Intermediate
1. Command Level Programming
2. Basics Review
4. Java API
5. Simulations and Algorithm Analysis
6. Classes and Objects
7. More on Classes
8. Data Structures
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.