Give examples of the Built in Data Types of Java.
Advertisements
Question
Give examples of the Built in Data Types of Java.
Very Long Answer
Advertisements
Solution
The examples of built-in data types of Java are as follows:
- byte: It is used to store small integer values. Example:
byte a = 10; - short: It is used to store integer values. Example:
short b = 200; - int: It is used to store whole numbers. Example:
int age = 18; - long: It is used to store large integer values. Example:
long population = 1000000L; - float: It is used to store decimal numbers with single precision. Example:
float marks = 85.5f; - double: It is used to store decimal numbers with double precision. Example:
double price = 125.75; - char: It is used to store a single character. Example:
char grade = 'A'; - boolean: It is used to store logical values, either
trueorfalse. Example:boolean result = true;
shaalaa.com
Is there an error in this question or solution?
