Class variables are called as java attributes for class.
We can define variable by data types.
Example :
public class Main {
int p = 9;
int q = 2;
}
As per as above example, variable p and q are called as attributes for class Main.
We can access attributes by creating an object of the class as below.
Main obj = new Main();
System.out.println(obj.p);
System.out.println(obj.q);
Comments