Classes are how user-defined object types as well as library object types are modelled in software in an object-oriented programming language such as Java. Classes in Java are comprised of a class header, fields (variables to store object data), constructors (which are used to create an object of that class and initialise it) and methods (to perform any behaviours we require of our objects).
A class is a blueprint or prototype from which objects of that class are created. It represents the kinds of data (fields) and behaviours (methods) that are common to all objects of that type. Not every aspect of an entity need be represented in a class, only those that are important to the problem we are working on.
An example is a TicketMachine class that models how a self-service ticket machine in a train station works. The TicketMachine class might have fields to store the total amount to be paid, the price of a ticket and the amount of money inserted in the machine so far. The kinds of behaviour (methods) that it might define include calculating how much has been paid so far and printing the ticket.
An object is said to encapsulate (or bundle together) the data pertaining to itself with the behaviours it can perform. Because a class is just a template for objects, many different TicketMachine objects can be created from the TicketMachine class and each object of that class will store the same kinds of data (with values such as price that suit that particular object) and be able to perform the same behaviours (such as printing tickets).
It is impossible to write a Java program without understanding how to write classes and objects. A Python programmer, on the other hand, may choose whether or not to use classes and objects.