Primitive Data Type boolean

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

Answer:

The character is not surrounded by apostrophes. It should be: 'W' .

With double quotes, "W", you get a String that contains a single character. This is not the same as a primitive single character. A String is represented as an object and may consist of several hundred bytes. A primitive character data item is always only two bytes.

Primitive Data Type boolean

Another of the primitive data types is the type boolean. It is used to represent a single true/false value. A boolean value can have only one of two values:

true              false

In a Java program, the words true and false always mean these boolean values. The data type boolean is named after George Boole, a nineteenth century mathematician, who discovered that a great many things can be done with true/false values (otherwise known as bits).

QUESTION 15:

Would you like a data type named after you someday?

  true     false