What are the differences between Case class and Normal Class?
Answer Posted / Avinash Kumar Munda
A case class in Scala is a lightweight alternative to regular classes that provides several useful features like automatic generation of toString, hashCode, equals, and copy methods. A normal class does not have these generated methods and requires explicit implementation. Case classes also provide pattern matching support. Additionally, case classes create immutable objects by default, while regular classes can be either mutable or immutable.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers