Boolean type values are true or false only in lower case.Example:1. boolean b=false; //(valid)2. boolean b=0; //(invalid)3. boolean b=False; //(invalid)4. boolean b=”false”; //(invalid)
Category: Java
Floating Point Literals
Floating point literals is by default double type. But it can be explicitly as float type by suffixing with f or F.Example:float f=123.546; //(invalid)float f=123.546f; //(valid)double d=123.546; //(valid) Floating point [ … ]
Integral Literals
For the integral data types we can specify literal value in the following ways.1) Decimal Literals: It allows 0 to 9 digits.2) Octal Literals: It allows 0 to 7 digits. [ … ]
Literals
Any constant value which are assigned to the variables are called literal. Example:int x=10 int —-> datatype|keywordx ——-> name of variable|identifier10 —–> constant value|literal
Char Data Type
Char Data Type:In previous languages like C and C++ are ASCII code based the number of ASCII code characters are <256 to represent these 256 characters 8-bits enough hence char [ … ]
Boolean Data Type
Boolean Data Type:Size: Not applicable (virtual machine dependent)Range: Not applicable but allowed values are true or false.
Floating Point Data Type
Float Description If we want 5 to 6 decimal places then we use float If we want 14 to 15 decimal places then we use double Size: 4 bytes Size: [ … ]
Integral Data Type
Byte:Size: 1 byte (8 bits)Maxvalue: +127Minvalue: -128 Range: -128 to 127[-27 to 27-1] Short:The most rarely used data type in java in short.Size: 2 bytesRange: -32768 to 32767 [-215 to [ … ]
Data Types
Data type is a keyword used to identify type of data. Data types in java are defined as specifiers that allocates space and type of values stored in the variable/identifiers. [ … ]