Home / Questions / Can every class be referred to as a user-defined datatype?
Explanatory Question

Can every class be referred to as a user-defined datatype?

👁 49 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

  • If the class is written by you (the programmer) → Yes, it is a user-defined datatype.

  • If the class is part of the Java API (like String, ArrayList, Scanner) → No, these are pre-defined datatypes (though still reference/composite types).

👉 In short:

  • Every class=a reference type.

  • If programmer creates it → user-defined.

  • If Java provides it → pre-defined.