In the previous chapter, we used the term "variable" for x in the example (as shown below). It is actually an attribute of the class. Or you could say that class attributes are variables within a class:
Example
Create a class called "Main" with two attributes: x and y:
public class Main {
  int x = 5;
  int y = 3;
}
Another term for class attributes is fields.
 
Practice Excercise Practice now