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
Nesta página do site você pode assistir ao vídeo on-line Boolean and Char Data Type in Java || Lesson 6 || Java Programming || Learning Monkey || duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Wisdomers - Computer Science and Engineering 02 Abril 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 886 vezes e gostou 13 espectadores. Boa visualização!