मराठी

Differentiate between a wrapper class and a Primitive Type.

Advertisements

प्रश्न

Differentiate between a wrapper class and a Primitive Type.

फरक स्पष्ट करा
Advertisements

उत्तर

Wrapper Class

Primitive Type

1. A wrapper class is a predefined class in Java that represents a primitive data type as an object.

1. A primitive type is a basic built-in data type in Java that is used to store simple values.

2. A wrapper class represents a primitive value within an object and allows it to be treated as an object.

2. A primitive type stores its actual value directly without creating an object.

3. A wrapper class provides various predefined methods for converting, comparing and manipulating data.

3. A primitive type does not contain methods for converting or manipulating its values.

4. A wrapper class generally requires more memory because it represents data in the form of an object.

4. A primitive type generally requires less memory because it stores only the basic data value.

5. A wrapper class can hold a null reference to represent the absence of an object.

5. A primitive type cannot hold a null value because it stores an actual primitive value.

6. Wrapper classes are useful when working with collections and methods that require objects.

6. Primitive types are useful for performing basic calculations and storing simple data efficiently.

7. Examples: Integer, Double, Character and Boolean are wrapper classes in Java.

7. Examples: int, double, char and boolean are primitive data types in Java.

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 5: Primitive Values, Wrapper Classes, Types and Casting - EXERCISE [पृष्ठ ११२]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
पाठ 5 Primitive Values, Wrapper Classes, Types and Casting
EXERCISE | Q 6. | पृष्ठ ११२
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×