Digits are Characters

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

Could the user include digits like 123 in the input characters?

Answer:

Yes. They are characters just like any other.

Digits are Characters

As far as this program is concerned, a string of digits is a string of characters and treated like any string of characters. They are not automatically converted into a numeric type. Here is another run of the program:

another run

In a few pages you will see a program that reads in a string of digits and converts them into a numeric data type. Then arithmetic can be done with that data.

QUESTION 8:

Is data from the keyboard always only characters?