Wednesday, November 25, 2015

How To Use Variables In Java Programs Post 9

Hi All...!

Today I'm going to teach you how to work with char data type. char is 16 bit data type if you are not familiar with char data type please read 8 Basics topic.

Let's get to coding,

Declare and initialize char variable,

There are number of way to declare and initialize char variables but I'm going to show you the most commonly using ways,

We can directly assign single character to char variable, here we have to write that character in side the single quotation marks.




The other way is using "ASCII" codes we can also initialize the char variables, when we use ascii codes we don't want to use single quotation marks.




ASCII code table is given below




Another way to initialize char variables is using unicodes,



Following is table of some unicodes,



See you guys on my next post bye...!

No comments:

Post a Comment