70 Slides Control Flow Parsing Values and Reading Input Using System - Console
70 Slides Control Flow Parsing Values and Reading Input Using System - Console
console()
In the last video, I talked about static and instance fields, and methods on the class.
I also talked about a concept called instantiating a class, which creates an object or
instance.
I'll be using both of these features in this video.
I'm going to create an interactive application where a user will enter their name and
year of birth, and then the application will calculate the current age of the user.
Before we start though, let's talk about parsing data.
When we read data in from either a file or from user input, it's common for the data
to be initially stored as a String, which we'll need to convert to a numeric value.
Let's review what happens when our numeric data is really a String.
You might remember I talked about this previously when I talked about operators in
Java, and how the plus symbol means something different for numeric values than it
does for Strings.
You might also remember that many of the other operators aren't applicable to
Strings.
Let's look at a slide we've seen before.