Showing posts with label char. Show all posts
Showing posts with label char. Show all posts
Monday, February 25, 2013
Character wrapper class for char
"Characters (The Java™ Tutorials > Learning the Java Language > Numbers and Strings)" ( http://bit.ly/LUgCyw )
Saturday, June 2, 2012
Switch
CODE DOWNLOAD: UsingSwitch.zip
A Switch can be used to evaluate a number of numeric types such as byte, short, char & int.
Let's say you want to check the value of a single variable and based on this value, one of many things may happen.
In the example below, the user enters a number. This number is then checked by the switch. The first case to match, executes a statement - in this case, printing a message to let the user know what the entered value was.
Of course, we could use a number of if then else statements to achieve the same result, however, as we are only checking the value of a single variable, the switch is a more elegant and readable solution (subjective).
Here's a cat:
"The switch Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)" ( http://bit.ly/y2TVYE )
A Switch can be used to evaluate a number of numeric types such as byte, short, char & int.
Let's say you want to check the value of a single variable and based on this value, one of many things may happen.
In the example below, the user enters a number. This number is then checked by the switch. The first case to match, executes a statement - in this case, printing a message to let the user know what the entered value was.
If the user entered a value not listed in the cases, the default section executes. It is good practice to always include a default case in your switch.
Notice that the final statement in each case is break. This causes the switch to stop checking down the list.
We can also execute a common statement for multiple cases, as in the example below:
Here's a cat:
"The switch Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)" ( http://bit.ly/y2TVYE )
Tuesday, March 27, 2012
A handful of data types & variables
String
Any collection of keyboard characters.
Boolean
A true or false value.
Char
A single keyboard character.
int
A whole number between -2,147,483,648 and 2,147,484,647
Any collection of keyboard characters.
Boolean
A true or false value.
Char
A single keyboard character.
int
A whole number between -2,147,483,648 and 2,147,484,647
Sunday, March 18, 2012
The char data type
The
char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff'
"Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)" ( http://bit.ly/xesQuj )
Default value of primitive data types
Labels:
boolean,
byte,
char,
Data Types,
Default values,
double,
float,
int,
long,
Primitive data types,
short,
string
Subscribe to:
Posts (Atom)





