Junior — Middle
What is the purpose of a class in programming?
sobes.tech AI
Answer from AI
A class in programming serves as a template for creating objects, combining data (fields) and methods to work with that data. It allows encapsulating state and behavior, providing code reuse and program structure. For example, a User class might contain name and email fields and methods to modify these data.