Write about the various Data Types of Java.
Advertisements
प्रश्न
Write about the various Data Types of Java.
विस्तार में उत्तर
Advertisements
उत्तर
- Primitive Data Types: These are the basic built-in data types used to store simple values such as integers, decimal numbers, characters and logical values. Java provides eight primitive data types:
- byte: It is used to store small integer values.
- short: It is used to store integer values.
- int: It is used to store whole numbers.
- long: It is used to store large integer values.
- float: It is used to store decimal numbers with single precision.
- double: It is used to store decimal numbers with double precision.
- char: It is used to store a single Unicode character.
- boolean: It is used to store logical values, either
trueorfalse.
- Non-Primitive Data Types: These are reference data types used to represent objects and more complex data structures. They can store references to objects and provide methods for performing various operations. The main non-primitive data types include:
- String: It is used to store and manipulate sequences of characters.
- Array: It is used to store multiple values of the same data type.
- Class: It is a blueprint used to create objects with data members and methods.
- Interface: It is used to define a contract that classes can implement.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
