Boolean and Char Data Type in Java
In this class, We discuss Boolean and Char Data Type in Java.
The reader should know about integer and floating point data types in java. Click Here.
Boolean:
The boolean data type will take only two values. True or false.
boolean a = true;
The variable a is taking the true value.
Character:
The character data type is used to store a character.
Example:
char b =’A’;
b is a variable of type character.
The variable b will hold a character in upper case A.
We use single quotes to represent characters in java.
The character data type will take 2 bytes of memory.
Computers are capable of storing binary digits.
To store a character, we need to convert the character to binary.
Each character should assign a unique number.
We need a standard for the conversion of characters.
Java uses 16-bit Unicode characters.
List of 16-bit Unicode characters: Click Here
The upper case A is given a decimal value of 65.
The above link shows in hexadecimal value.
The hexadecimal value for upper case A is 0041.
If we convert the hexadecimal 0041 to decimal, we get 65.
The below program shows the example to display the value 65 to upper case A.
char x = ‘A’;
int b = (int)x;
System.out.println(b)
Output: 65
Link for playlists:
/ @wisdomerscse
Link for our website: https://learningmonkey.in
Follow us on Facebook @ / learningmonkey
Follow us on Instagram @ / learningmonkey1
Follow us on Twitter @ / _learningmonkey
Mail us @ learningmonkey01@gmail.com
Auf dieser Seite können Sie das Online-Video Boolean and Char Data Type in Java || Lesson 6 || Java Programming || Learning Monkey || mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Wisdomers - Computer Science and Engineering 02 April 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 886 Mal angesehen und es wurde von 13 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!