What are Java Class Variables?

Answer:
Class Variables or Instances variables are variables that are declared inside a class and are available for the whole class. They are available for all instances of that class and are not specific to any method.

Ex:

public class Test {

private String name = "Rocky";

}

Here name is a class variable.

First answer by Anandvijayakumar. Last edit by Anandvijayakumar. Contributor trust: 782 [recommend contributor recommended]. Question popularity: 1 [recommend question].