English

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:

  1. byte: It is used to store small integer values. Example: byte a = 10;
  2. short: It is used to store integer values. Example: short b = 200;
  3. int: It is used to store whole numbers. Example: int age = 18;
  4. long: It is used to store large integer values. Example: long population = 1000000L;
  5. float: It is used to store decimal numbers with single precision. Example: float marks = 85.5f;
  6. double: It is used to store decimal numbers with double precision. Example: double price = 125.75;
  7. char: It is used to store a single character. Example: char grade = 'A';
  8. boolean: It is used to store logical values, either true or false. Example: boolean result = true;
shaalaa.com
  Is there an error in this question or solution?
Chapter 5: Primitive Values, Wrapper Classes, Types and Casting - EXERCISE [Page 112]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 5 Primitive Values, Wrapper Classes, Types and Casting
EXERCISE | Q 3. | Page 112
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×