English

Which of the following is an invalid statement? (a) A class is a composite data type (b) Statement import is used for including a package (c) Primitives have fixed size (d) String is a primitive

Advertisements
Advertisements

Question

Which of the following is an invalid statement?

Options

  • A class is a composite data type

  • Statement import is used for including a package

  • Primitives have fixed size

  • String is a primitive

MCQ
Advertisements

Solution

String is a primitive

Explanation:

This statement is invalid because String is a non-primitive (reference) data type in Java. Unlike primitive types (like int, char, or double) which hold raw values directly in fixed memory slots, a String is an object instantiated from a full class in the java.lang package designed to hold and manipulate character sequences.

shaalaa.com
  Is there an error in this question or solution?
Chapter 5: Library Classes - Exercises [Page 133]

APPEARS IN

Rupa Pandit Computer Applications [English] Class 10 ICSE
Chapter 5 Library Classes
Exercises | Q 1. (vii) | Page 133
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×