10.) Write down the data type of the following:
(a) Integer
(b) Long Integer
(c) A fractional number
(d) A special character
11.) What do you understand by Boolean data type? Explain with an example.
12.) What do you understand by primitive data type? Give two examples.
13.) Why is it necessary to define data types in Java programming?
Answers
Question
10.) Write down the data type of the following:
(a) Integer - int
(b) Long Integer - long
(c) A fractional number - float or double
(d) A special character - char
11.) What do you understand by Boolean data type? Explain with an example.
A Boolean data type can only have two values: true or false. It is like a yes/no or on/off - a very key component of any programming language. Boolean logic is even embedded in other components of Java: an if statement, for example, executes if and only if the condition provided is true.
Example
For example, the comparisons 3 < 5, x < 5, x < y and Age < 16 are Boolean expressions. The comparison 3 < 5 will always give the result true, because 3 is always less than 5.
12.) What do you understand by primitive data type? Give two examples.
A primitive data type is pre-defined by the programming language. The size and type of variable values are specified, and it has no additional methods.
Example
They are as follows:
- Boolean data type
- byte data type
- char data type
- short data type
- int data type
- long data type
- float data type
- double data type
13.) Why is it necessary to define data types in Java programming?
Data types are especially important in Java because it is a strongly typed language. This means that all operations are type-checked by the compiler for type compatibility. To enable strong type checking, all variables, expressions, and values have a type.
Mark me the Brainliest.