Data Types I: int
Creating more useful Java programs will likely require you to work with several additional types of data. Let's explore a few of them.
The first data type we will use is
1.
int.1.
int is short for integer, which are all positive and negative numbers, including zero. This number could represent the number of visits a website has received or the number of programming languages you know.- The
intdata type only allows values between -2,147,483,648 and 2,147,483,647. Data Types II: boolean
- Fantastic! You just printed an
intdata type.The next data type we will use is theboolean. - 1: A
booleanis a data type that can only be eithertrueorfalse
Data Types III: char
Perfect. Let's look at one more Java data type:
char.
The
char data type is used to represent single characters. That includes the keys on a keyboard that are used to produce text.
1:
char is short for character and can represent a single character.
2: All
char values must be enclosed in single quotes, like this: 'G'
java language example codes
ReplyDeletejava programming - Scaled Image