What is the purpose of creating a class-level variable in Java?


I was writing a piece of code that goes like this,

public class Grades
   public int marks; // what's the purpose of this?

Objects are data and methods encapsulated together into a single software component.

Classes are templates ("cookie cutters") from which you can create one or more instances in memory ("cookies"). Each one is independent; each can have its own state.