Java Programming tutorial with officialhord - Variable types [char]

Words
121
Reading
1 min
Listen
Play
9y

sample.jpg

char

This is a data type in java that allows you to store only one character alphanumeric data, as it is just 2 bytes in size, storing more would be a practically impossible.

How to use char

To declare a variable of data type char, your code should look like this;
char x = 'A';
char d = 'x'
char (name of the variable) = '(character to be stored)'

This would work on any java programming platform.

Try not to use more than one character when using the char data type and if you want to use more than one, you can declare that as an array of char which would be visited in the next tutorial.
Thanks for following.



Posted on Utopian.io - Rewarding Open Source Contributors

Java Programming tutorial with officialhord - Variable types [char] | Ecency